0

Ii'm trying to force HTTPS redirection in IIS, based on the article

https://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference#Accessing_URL_Parts_from_a_Rewrite_Rule

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 ?

Tony
  • 12,405
  • 36
  • 126
  • 226

1 Answers1

1

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>
Vlado Pandžić
  • 4,879
  • 8
  • 44
  • 75