Reputation: 12695
Ii'm trying to force HTTPS redirection in IIS, based on the article
what's strange, when I create the Redirect URL as follows
https://{HTTP_HOST}/{REQUEST_URI}
and I open http://some.com/somePage, instead of being redirected to https://some.com/somePage I'm redirected to https://some.com/h
what's that 'h'
letter at the end and why 'somePage'
is missing ?
Upvotes: 0
Views: 351
Reputation: 5048
This is the code that redirects every http
link to it's https
version.
If you put it in the web config it should work:
<rule name="Redirect to www MAIN" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^yourdomain.com$" />
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://www.yourdomain.com/{R:0}" redirectType="Permanent" />
</rule>
Upvotes: 1