Reputation: 1708
I have the following URL rewrite rule configured in my web.config file:
<rule name="Test Rule" stopProcessing="true">
<match url="^$" />
<conditions>
<add input="{QUERY_STRING}" pattern=".*item=1|all|none|first.*" />
</conditions>
<action type="Rewrite" url="/newsite/test.asp?{C:0}" />
</rule>
The following source url matches as expected:
http://domainname?item=1
However the query string parameter "item" is duplicated in the rewritten URL i.e. the resulting query string is "item=1&item=1". I don't know why it is being duplicated. Any ideas?
Thank you
Upvotes: 1
Views: 496
Reputation: 25310
Have you tried adding appendQueryString="false"
to the action attribute? Like this:
<rule name="Test Rule" stopProcessing="true">
<match url="^$" />
<conditions>
<add input="{QUERY_STRING}" pattern=".*item=1|all|none|first.*" />
</conditions>
<action type="Rewrite" url="/newsite/test.asp?{C:0}" appendQueryString="false" />
</rule>
Upvotes: 1