重写IIS URL以指向WordPress的子文件夹

时间:2013-01-08 18:26:44

标签: wordpress iis url-rewriting web-config

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

Site1
Site1\Site2
Site1\Site3

我有四个URL 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>

任何帮助都非常感激。

0 个答案:

没有答案