[英]IIS7 Redirect using Rewrite module Issue
我更改了域名,並嘗試重定向所有請求,除了一些URL。 但是我似乎無法使其表現出預期的效果,並且一切都被重定向了-我確定它一定很小-任何幫助將不勝感激!
我需要重定向所有URL,但路徑為“ auth”或“ ipet”的文件以及包括其querystring的file.aspx除外。 olddomain.com的其余部分應全部重定向到newdomain.com。
<rule name="Redirect" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions trackAllCaptures="false" logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="www\.olddomain\.com" />
<add input="{URL}" pattern="^file.aspx$" negate="true" />
<add input="{URL}" pattern="^auth/?" negate="true" />
<add input="{URL}" pattern="^ipet/?" negate="true" />
</conditions>
<action type="Redirect" url="http://newdomain.com" />
</rule>
使用以下..不帶^
:
<add input="{URL}" pattern=".*?auth/?" negate="true" />
<add input="{URL}" pattern=".*?ipet/?" negate="true" />
logicalGrouping =“ MatchAll”表示所有條件都必須為真才能進行重定向。 更改logicalGrouping =“ MatchAny”並更改匹配網址。
<rule name="Redirect" enabled="true" stopProcessing="true">
<match url="www\.olddomain\.com" />
<conditions trackAllCaptures="false" logicalGrouping="MatchAny">
<add input="{REQUEST_URI}" pattern=".*?file.aspx$" negate="true" />
<add input="{REQUEST_URI}" pattern=".*?auth/?" negate="true" />
<add input="{REQUEST_URI}" pattern=".*?ipet/?" negate="true" />
</conditions>
<action type="Redirect" url="http://newdomain.com" />
</rule>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.