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

IIS7 Redirect using Rewrite module Issue

我已经更改了域并尝试重定向除少数 URL 之外的所有请求。但是我似乎无法让它按预期运行并且一切都被重定向 - 我确定它一定是小东西 - 任何帮助将不胜感激!

我需要重定向所有 URL,路径为 "auth" 或 "ipet" 的任何内容以及包含其查询字符串的 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" 并更改匹配 url.

<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>