1

現在、サーバールートにワードプレスをインストールしていますが、別のワードプレスサイトをサブフォルダー「new-site」に追加しています。

これは IIS サーバーなので、wordpress によると、web.config ファイルのルート ディレクトリにこれが含まれている必要があります。

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

私が今直面している問題: ルートの web.config ファイル (以下) を変更して、/new-site への WP インストールが正常に機能するようにする方法。(私のローカルホストでは問題なく動作しており、wp-options の URL を変更しました。new-site のホームページは問題ないように見えますが、リンクをクリックすると、ルート サイトのエラー ページになります。) ありがとう!

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

1 に答える 1

6

解決しました。サブフォルダーの 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>

ソース: http://forums.iis.net/post/1883731.aspx

于 2013-02-21T00:11:03.637 に答える