1

我在同一台服务器上安装了三个 Wordpress,它们的布局如下:

Site1
Site1\Site2
Site1\Site3

我有四个网址 www.site1.com、www.site2.co.uk、www.site2.com 和 www.site3.co.uk。我想在 web.config 文件中设置 URL 重写,以便 URL 指向它们对应的文件夹。我还需要安装 Wordpress 才能使用永久链接。

这是我目前的设置(完全不起作用):

<rule name="site1" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*"/>
            <action type="Rewrite" url="index.php"/>
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                <add input="{HTTP_HOST}" matchType="Pattern" pattern="*www.site2.co*" ignoreCase="true" negate="true"/>
                <add input="{HTTP_HOST}" matchType="Pattern" pattern="*www.site3.co*" ignoreCase="true" negate="true"/>
                <add input="{PATH_INFO}" pattern="*site2*" negate="true"/>
                <add input="{PATH_INFO}" pattern="*site3*" negate="true"/>
            </conditions>
        </rule>v
        <rule name="site2" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*"/>
            <action type="Rewrite" url="site2/index.php"/>
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                <add input="{HTTP_HOST}" matchType="Pattern" pattern="*www.site2.co*" ignoreCase="true" negate="false"/>
                <add input="{PATH_INFO}" pattern="*site2*" ignoreCase="true" negate="false"/>
                <add input="{PATH_INFO}" pattern="*wp-admin*" negate="true"/>
                <add input="{PATH_INFO}" pattern="*wp-content*" negate="true"/>
                <add input="{PATH_INFO}" pattern="*wp-login*" negate="true"/>
            </conditions>
        </rule>
        <rule name="site2-content" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*"/>
            <action type="Rewrite" url="site2/{R:0}"/>
            <conditions>
                <add input="{HTTP_HOST}" pattern="*www.site2.co*"/>
                <add input="{PATH_INFO}" pattern="*wp-content*"/>
            </conditions>
        </rule>
        <rule name="site2-admin" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*"/>
            <action type="Rewrite" url="site2/{R:0}"/>
            <conditions>
                <add input="{HTTP_HOST}" pattern="*www.site2.co*"/>
                <add input="{PATH_INFO}" pattern="*wp-admin*"/>
            </conditions>
        </rule>
        <rule name="site2-login" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*"/>
            <action type="Rewrite" url="site2/{R:0}"/>
            <conditions>
                <add input="{HTTP_HOST}" pattern="*www.site2.co*"/>
                <add input="{PATH_INFO}" pattern="*wp-login*"/>
            </conditions>
        </rule>
    <rule name="site3" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*"/>
            <action type="Rewrite" url="site3/index.php"/>
            <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                <add input="{HTTP_HOST}" matchType="Pattern" pattern="*www.site3.co*" ignoreCase="true" negate="false"/>
                <add input="{PATH_INFO}" pattern="*site3*" ignoreCase="true" negate="false"/>
                <add input="{PATH_INFO}" pattern="*wp-admin*" negate="true"/>
                <add input="{PATH_INFO}" pattern="*wp-content*" negate="true"/>
                <add input="{PATH_INFO}" pattern="*wp-login*" negate="true"/>
            </conditions>
        </rule>
        <rule name="site3-content" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*"/>
            <action type="Rewrite" url="site3/{R:0}"/>
            <conditions>
                <add input="{HTTP_HOST}" pattern="*www.site3.co*"/>
                <add input="{PATH_INFO}" pattern="*wp-content*"/>
            </conditions>
        </rule>
        <rule name="site3-admin" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
        <match url="*"/>
        <action type="Rewrite" url="site3/{R:0}"/>
        <conditions>
            <add input="{HTTP_HOST}" pattern="*www.site3.co*"/>
            <add input="{PATH_INFO}" pattern="*wp-admin*"/>
        </conditions>
        </rule>
        <rule name="site3-login" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
            <match url="*"/>
            <action type="Rewrite" url="site3/{R:0}"/>
            <conditions>
                <add input="{HTTP_HOST}" pattern="*www.site3.co*"/>
                <add input="{PATH_INFO}" pattern="*wp-login*"/>
            </conditions>
        </rule>
        <rule name="wordpress" patternSyntax="Wildcard" stopProcessing="true">
            <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>

非常感谢任何帮助。

4

0 回答 0