简体   繁体   English

IIS Url Rewrite for Wordpress子文件夹站点

[英]IIS Url Rewrite for Wordpress subfolder site

I run two separate Wordpress instances one in the root folder and one in a subfolder. 我在根文件夹中运行两个单独的Wordpress实例,在子文件夹中运行一个。 These Wordpress instances runs on IIS. 这些Wordpress实例在IIS上运行。

I got the permalinks to work on the root wordpress instance. 我得到了在根wordpress实例上工作的固定链接。 But it doesn't work on the wordpress in the subfolder. 但这不适用于子文件夹中的wordpress。

I am trying with a separate web.config in the subfolder with this ruleset. 我正在尝试使用此规则集在子文件夹中使用单独的web.config。 But it will not work correctly. 但是它将无法正常工作。 What can be wrong? 有什么事吗

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

Thanks to: MVC3 + WordPress IIS Url Rewriting Rules 由于: MVC3 + WordPress IIS Url重写规则

I found the trick: 我发现了窍门:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM