Typically http to https configuration would be common as the canonical name redirect either http:// or http://www to https. This may be the site requirement as https:// or https://www
In our scenario, rewrite rule could be managed to https://www with canonical name.
Whenever client end entering the URL as http://www.sathiya.io or http://sathiya.io would be automatically redirect to https://www.sathiya.io site.
More about rewrite rule on Microsoft article
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<rewrite> <rules> <rule name=“Canonical Host Name (HTTP)” stopProcessing=“true”> <match url=“(.*)” /> <conditions logicalGrouping=“MatchAll”> <add input=“{HTTPS}” pattern=“OFF” /> <add input=“{HTTP_HOST}” pattern=“(?=^sathiya\.io)(?=^(.(?!\/ezine\/))*$)” /> </conditions> <action type=“Redirect” url=“http://www.sathiya.io/{R:1}” redirectType=“Permanent” /> </rule> <rule name=“Canonical Host Name (HTTPS) www” stopProcessing=“true”> <match url=“(.*)” /> <conditions logicalGrouping=“MatchAll”> <add input=“{HTTPS}” pattern=“OFF” /> <add input=“{HTTP_HOST}” pattern=“(?=^www.sathiya\.io)(?=^(.(?!\/ezine\/))*$)” /> </conditions> <action type=“Redirect” url=“https://www.sathiya.io/{R:1}” redirectType=“Permanent” /> </rule> <rule name=“Canonical Host Name (HTTPS)” stopProcessing=“true”> <match url=“(.*)” /> <conditions logicalGrouping=“MatchAll”> <add input=“{HTTPS}” pattern=“ON” /> <add input=“{HTTP_HOST}” pattern=“(?=^sathiya\.io)(?=^(.(?!\/ezine\/))*$)” /> </conditions> <action type=“Redirect” url=“https://www.sathiya.io/{R:1}” redirectType=“Permanent” /> </rule> </rules> </rewrite> |
Cheers!
2 responses to “HTTP to HTTPS rewrite rule”
[…] HTTP to HTTPS rewrite rule for windows platform IIS on previous post. If the web server as linux based environment that can be archived and play with .htaccess […]
[…] HTTP to HTTPS rewrite rule for windows platform IIS on previous post. If the web server as linux based environment that can be archived and play with .htaccess […]