2017-06-13 112 views
0

我有wordpress安装在一个名为'blog'的子目录下的主根文件夹中,并且web.config URL重写为根目录中的.php扩展名夹。我在'blog'子目录中也有标准的wordpress web.config文件。IIS php扩展URL重写规则和wordpress在子目录冲突

除了某些原因,登录页面在登录时不断刷新自身,导致我相信存在冲突。

会忽略根web.config帮助中的'blog'目录吗?我已经尝试过,但我收到的只有500个错误。

这里是根web.config ...

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
<system.webServer> 
<rewrite> 
<rules> 
<rule name="Redirect .php extension" stopProcessing="false"> 
    <match url="^(.*).php$" ignoreCase="true" /> 
<conditions logicalGrouping="MatchAny"> 
    <add input="{URL}" pattern="(.*).php$" ignoreCase="false" /> 
</conditions> 
    <action type="Redirect" url="{R:1}" redirectType="Permanent" /> 
</rule> 
<rule name="hide .php extension" stopProcessing="true"> 
    <match url="^(.*)$" ignoreCase="true" /> 
<conditions> 
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
    <add input="{REQUEST_FILENAME}.php" matchType="IsFile" /> 
    </conditions> 
    <action type="Rewrite" url="{R:0}.php" /> 
</rule> 
</rules> 
</rewrite> 
</system.webServer> 
</configuration> 

这里是博客/ web.config中......

<?xml version="1.0" encoding="UTF-8"?> 
<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> 

任何想法非常赞赏。

回答

0

我终于找到了这个问题的解决方案,现在它可以工作。

我添加了一个新的规则,以省略博客文件夹... <rule name="block" stopProcessing="true"> <match url="^blog/wp-login.php$" /> <action type="None" /> </rule>

这克服了问题。此解决方案在... How to exclude a directory with IIS URL rewriting