http:// . . .
https:// . . .
<system.webServer> <rewrite xdt:Transform="Insert"> <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> </system.webServer>
web.Release.config
<system.webServer> <rewrite xdt:Transform="Insert"> <rules> <rule name="HTTPS rewrite behind ELB rule" enabled="false" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions> <add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" ignoreCase="false" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{SERVER_NAME}{URL}" /> </rule> </rules> </rewrite> </system.webServer>
http://yoursite.com
index.html
web.config
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <httpRedirect enabled="true" destination="https://yoursite.com" httpResponseStatus="Permanent" /> </system.webServer> </configuration>