2013-06-01 53 views
0

我發現下面的代碼,將我所有的流量重定向到https:Web.Release.Config Rewite URL排除

<system.webServer> 
<rewrite xdt:Transform="Insert"> 
    <rules> 
    <rule name="RedirectToHTTPS" stopProcessing="true"> 
     <match url="(.*)" /> 
     <conditions> 
     <add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
     </conditions> 
     <action type="Redirect" url="https://{SERVER_NAME}/{R:1}" redirectType="Permanent" /> 
    </rule> 
    </rules> 
</rewrite> 

是否有可能以一個「排斥」添加到該規則不知何故?

我想不被重定向如果可能的話

比如我想下面http://www.xyz.com/desktopmodules/一切不是重定向的特定路徑。

請問可以嗎?

回答

1

您可以添加它上面的規則,符合你的排斥模式,確保stopProcessing="true"設置的規則,但沒有行動:

<system.webServer> 
<rewrite xdt:Transform="Insert"> 
    <rules> 

    <!-- Prevent redirection of URLs matching this pattern --> 
    <rule name="ExcludeRedirectToHTTPS" stopProcessing="true"> 
     <match url="^desktopmodules.*" /> 
     <action type="None" /> 
    </rule> 

    <rule name="RedirectToHTTPS" stopProcessing="true"> 
     <match url="(.*)" /> 
     <conditions> 
     <add input="{HTTPS}" pattern="off" ignoreCase="true" /> 
     </conditions> 
     <action type="Redirect" url="https://{SERVER_NAME}/{R:1}" redirectType="Permanent" /> 
    </rule> 
    </rules> 
</rewrite>