【问题标题】:Second Wordpress installation on IIS serverIIS 服务器上的第二个 Wordpress 安装
【发布时间】:2013-02-19 20:34:59
【问题描述】:

我目前在我的服务器根目录中安装了一个有效的 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>

我现在面临的问题:如何修改 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>

【问题讨论】:

    标签: wordpress iis web-config


    【解决方案1】:

    解决了。在子文件夹的 web.config 中,添加&lt;clear /&gt;,使其不受根规则的影响。

    <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>
    

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

    【讨论】:

    • 能否请您发布根应用程序和子目录的最终 webconfig。我不断收到 500.19 错误,并且尝试了各种组合,但到目前为止都没有运气!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-07
    • 1970-01-01
    • 2019-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多