URL重写不适用于嵌套的WP安装

URL重写不适用于嵌套的WP安装

本文介绍了IIS URL重写不适用于嵌套的WP安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解决WP安装问题.我在服务器上安装了3份WP,如下所示.

I am trying to troubleshoot an issue with my WP install. I have 3 installs of WP on the server, as follows.

  • root(WordPress)
    • /样式(WordPress)
    • /分类(Wordpress)

    一个位于根目录的计算机正在工作,但是其他计算机则抛出500错误.他们最近确实有工作,但不确定发生了什么.

    The one at the root is working but the others are throwing a 500 error. they did work recently but not sure what happened.

    我认为这可能是配置和重写规则?

    I think it might be the config and rewrite rules?

    ROOT-WebConfig

    ROOT - WebConfig

        <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <rewrite>
          <rules>
                <rule name="wordpress" patternSyntax="Wildcard">
                    <match url="*"/>
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                        </conditions>
                    <action type="Rewrite" url="index.php"/>
                </rule></rules>
        </rewrite>
      </system.webServer>
    </configuration>
    

    样式-WebConfig

    STYLE - WebConfig

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <rewrite>
          <rules><rule name="Imported Rule 1" stopProcessing="true"><match url="^index\.php$" ignoreCase="false" /><action type="None" /></rule><rule name="Imported Rule 2" stopProcessing="true"><match url="." ignoreCase="false" /><conditions logicalGrouping="MatchAll"><add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /></conditions><action type="Rewrite" url="/index.php" /></rule>
                <rule name="wordpress" patternSyntax="Wildcard">
                    <match url="*" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
                </rules>
    <Clear/>
        </rewrite>
    
      </system.webServer>
    </configuration>
    

    ISS错误日志(出于安全考虑,已删除IP和网站网址)

    ISS ERROR LOG (IP and Website Url removed for security)

    #Software: Microsoft Internet Information Services 7.5
    #Version: 1.0
    #Date: 2013-12-21 17:43:52
    #Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
    2013-12-21 17:43:52 W3SVC9 AWKS 888.888.888.88 GET / - 443 - 88.888.88.888 HTTP/1.1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/31.0.1650.63+Safari/537.36 Comm100_CC_Identity_180737=-59;+comm100_session_180737=-73 - www.website.com 301 0 0 437 439 343
    

    推荐答案

    知道了.如果其他人在嵌套WP安装方面遇到问题,这就是我所做的.

    Got it. In case anyone else is having issues with nested WP installs, here is what I did.

    根目录-WEBCONFIG

    ROOTDIRECTORY - WEBCONFIG

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="wordpress" patternSyntax="Wildcard">
                    <match url="*" ignoreCase="false" />
                            <conditions>
                                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                                <add input="{REQUEST_URI}" pattern="^/(SUBDIRECTORY1|SUBDIRECTORY2)" negate="true" />
                            </conditions>
                        <action type="Rewrite" url="index.php" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
    

    子目录1&2-WEBCONFIG

    SUBDIRECTORY 1 & 2 - WEBCONFIG

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <rewrite>
            <rules>
            <rule name="SubSite Rule" stopProcessing="true">
                <match url=".*" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="index.php" />
            </rule>
        </rules>
        </rewrite>
      </system.webServer>
    </configuration>
    

    这篇关于IIS URL重写不适用于嵌套的WP安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 18:01