Skip to content

Instantly share code, notes, and snippets.

@Phuseos
Created May 24, 2017 07:52
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 Phuseos/f469713678b6270de1d9be7e728bcf02 to your computer and use it in GitHub Desktop.
Save Phuseos/f469713678b6270de1d9be7e728bcf02 to your computer and use it in GitHub Desktop.
(XML) Web.Config rewrite rule to auto-redirect to HTTPS
<?xml version="1.0"?>
<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