繁体   English   中英

IIS7重定向使用重写模块问题

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM