Skip to content

Instantly share code, notes, and snippets.

@aaronhoffman
Created August 8, 2016 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronhoffman/f6c1a121559595a70eb768badb87a59c to your computer and use it in GitHub Desktop.
Save aaronhoffman/f6c1a121559595a70eb768badb87a59c to your computer and use it in GitHub Desktop.
asp.net web.config redirect to https
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect_to_https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
<add input="{HTTP_HOST}" pattern="localhost" negate="true" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment