Skip to content

Instantly share code, notes, and snippets.

@leandrocustodio
Created April 3, 2017 17:17
Show Gist options
  • Save leandrocustodio/868721dbc455b8925ed2bd93236eb0fe to your computer and use it in GitHub Desktop.
Save leandrocustodio/868721dbc455b8925ed2bd93236eb0fe to your computer and use it in GitHub Desktop.
Use web.config to redirect user to a HTTPS connection
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment