IIS Url重写Wordpress子文件夹站点

时间:2014-06-13 14:54:31

标签: php wordpress .htaccess iis url-rewrite-module

我在根文件夹中运行两个单独的Wordpress实例,在子文件夹中运行一个。这些Wordpress实例在IIS上运行。

我得到了永久链接来处理root wordpress实例。但它不适用于子文件夹中的wordpress。

我正在尝试使用此规则集在子文件夹中使用单独的web.config。但它无法正常工作。什么可能是错的?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <httpErrors errorMode="Detailed" />
    <rewrite>
      <rules>
        <rule name="90-Numre" 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="^90-numre/index.php/{R:0}" /></rule>
            <rule name="wordpress1" 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="^90-numre\index.php" />
        </rule>     
        </rules>
    </rewrite>
    <defaultDocument>
      <files>
        <clear />

        <add value="index.php" />
      </files>
    </defaultDocument>
  </system.webServer>
    <system.web>
        <customErrors defaultRedirect="" mode="RemoteOnly" />
    </system.web>
</configuration>

1 个答案:

答案 0 :(得分:3)

感谢:MVC3 + WordPress IIS Url Rewriting Rules

我找到了诀窍:

<rewrite>
    <rules>
        <rule name="wordpress" patternSyntax="Wildcard">
            <match url="*" />
            <conditions logicalGrouping="MatchAll">
                <add input="{PATH_INFO}" pattern="/mymvcapp/*" negate="true" />
                <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>