Reputation: 1774
I have a IIS url rewrite rule in my website and I want to stop it for specific url to preappend www.
My current rule is:
<rewrite>
<rules>
<rule name="CanonicalHostNameRule1" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.example\.com$" negate="true" />
<add input="{HTTP_HOST}" pattern="^static\.example\.com$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.example.com/{R:1}" />
</rule>
</rules>
</rewrite>
Notice: my page url is http://example.com/chat?id=1&from=/somepage.aspx (have 2 query string id and from)
Upvotes: 1
Views: 2385
Reputation: 63243
Add a rule at top for exceptional URLs and change action to NoAction. Then stop execution and skip all the rest.
See this blog post for more details.
Upvotes: 2