But the problem is, if the url contains a query string - ex- www.xxx.com/x/y?id=1, its redirected to www.xxx.com/x/y?id=1&id=1 i.e it adds extra query strings.
The Request_URI server variable contains the query string information, so you need to set append query string to false to prevent duplicated query string. Like:
Sumit Kadam
1 Post
Extra query parameters added on redirection
Dec 04, 2012 05:27 AM|LINK
I am using url rewrite feature of IIS 7.
I have created following rule - for redirecting HTTP to HTTPS.
<rewrite>
<rules>
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}{REQUEST_URI}" />
</rule>
</rules>
</rewrite>
But the problem is, if the url contains a query string - ex- www.xxx.com/x/y?id=1, its redirected to www.xxx.com/x/y?id=1&id=1 i.e it adds extra query strings.
Any suggestion how to avoid it?
Lloyd Zhang
65 Posts
Re: Extra query parameters added on redirection
Dec 07, 2012 04:10 AM|LINK
The Request_URI server variable contains the query string information, so you need to set append query string to false to prevent duplicated query string. Like:
<action type="Redirect" redirectType="Found" appendQueryString="false" url="https://{HTTP_HOST}{REQUEST_URI}" />
Thanks.