Skip to content

Instantly share code, notes, and snippets.

@codingoutloud
Created September 6, 2013 05:21
Show Gist options
  • Save codingoutloud/6459839 to your computer and use it in GitHub Desktop.
Save codingoutloud/6459839 to your computer and use it in GitHub Desktop.
A rewrite rule for ASP.NET that will redirect HTTP requests to be HTTPS requests. Credit: Maarten Balliauw ( this guy: http://blog.maartenballiauw.be ) showed me how to do it.
<system.webServer>
<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment