2017-06-13 116 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