2013-09-30 26 views
2
<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
    <system.webServer> 
     <rewrite> 
      <rules> 
       <rule name="Main Rule" 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="index.php" /> 
       </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 

此规则位于我的wwwroot文件夹,它修复了我的URL,但它打破了我的OWA和RWW网站。WordPress的IIS 7.5 URL重写OWA和RWW 403.18禁止

如何向此规则添加异常或条件,以使其忽略特定地址?我正在尝试处理域名remote.mydomain.com

随着上述规则的到位,remote.mydomain.com,将返回403错误。

回答

1

您可以简单地添加一个条件,你的规则:

<rule name="Main Rule" stopProcessing="true"> 
    <match url=".*" /> 
    <conditions logicalGrouping="MatchAll"> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
     <add input="{HTTP_HOST}" pattern="^remote\.mydomain\.com$" negate="true" /> 
    </conditions> 
    <action type="Rewrite" url="index.php" /> 
</rule> 

条件

<add input="{HTTP_HOST}" pattern="^remote\.mydomain\.com$" negate="true" />` 

会阻止你的规则,从触发,如果被请求的主机正是remote.mydomain.com

+0

太谢谢你了,你解决了我的问题!我非常感谢您花时间回答并帮助解释病情发生的原因和方式。继续努力,再次感谢! – user2832360