If you need to force HTTPS on the entire site then add the following to the web.config file:
1 2 3 4 5 6 7 8 9 10 11 |
<rewrite> <rules> <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="[SOURCE]$" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/[DESTINATION]" /> </rule> </rules> </rewrite> |
If you want to force HTTPS on a specific URL, then use this instead:
1 2 3 4 5 6 7 8 9 10 11 |
<rewrite> <rules> <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> </rule> </rules> </rewrite> |