IIS服务器上的第二个Wordpress安装

Son*_* Ma 1 iis wordpress web-config

我目前在我的服务器根目录中安装了wordpress,但现在我将另一个wordpress网站添加到子文件夹"new-site".

它是一个IIS服务器,所以web.config文件应该在根目录中有这个,根据wordpress:

<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>
Run Code Online (Sandbox Code Playgroud)

我现在面临的问题:如何修改root的web.config文件(如下),以便/ new-site中的WP安装正常.(它在我的本地主机上工作正常,我已经更改了wp-options中的URL.新网站上的主页看起来很好但是如果你点击任何链接它将是根网站的错误页面.)谢谢!

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="4294967295" />
            </requestFiltering>
        </security>

        <rewrite>
            <rules>
                <rule name="Main 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>
                <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>

        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
                <add value="index.html" />
                <add value="Default.htm" />
                <add value="Default.asp" />
                <add value="index.htm" />
                <add value="aboutus.html" />
            </files>
        </defaultDocument>

        <handlers>
            <remove name="PHP53_via_FastCGI" />
            <remove name="AboMapperCustom-1045478" />
            <add name="PHP53_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.3\php-cgi.exe" resourceType="Either" requireAccess="Script" />
        </handlers>   
    </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

Son*_* Ma 5

解决了.在子文件夹中的web.config中,添加<clear />以使其不受根规则的影响.

<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <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>
Run Code Online (Sandbox Code Playgroud)

资料来源:http://forums.iis.net/post/1883731.aspx