Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, February 17, 2017 3:26 PM
Hi,
I just started using the following url redirect rule but all links appear to redirect correctly except the ones that come from an email.
It replaces it as such:
http://www.mysite.com/te2/35?returnUrl=5 to https://www.mysite.com/te2/35?returnUrl=5&returnUrl=5
<rewrite>
<rules>
<rule name="HTTP to HTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
** **
All replies (3)
Monday, February 20, 2017 6:12 AM ✅Answered
Hi Engcanada,
You could update the rule like following.
<rewrite>
<rules>
<rule name="HTTP to HTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
Best Regards,
Chris
Tuesday, February 21, 2017 7:31 AM ✅Answered
Hi Engcanada,
{REQUEST_URI} contains the entire requested URL including query string, so your original rule would end up duplicating query string parameters when redirecting.
appendQueryString – Specifies whether the query string from the current URL is preserved during substitution. By default, if the value of the appendQueryString flag is not specified, it is assumed to be TRUE. This means that the query string from the original URL is appended to the substituted URL.
reference:
https://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference
https://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference
Best Regards,
Chris
Monday, February 20, 2017 3:48 PM
I added the following and seems to be working:
appendQueryString="false" url="https://{HTTP_HOST}{REQUEST_URI}"
What exactly is the difference between:
url="https://{HTTP_HOST}/{R:1}" and url="https://{HTTP_HOST}{REQUEST_URI}"
Regards