Skip to content

Instantly share code, notes, and snippets.

@kaushalp
Created May 8, 2017 14:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaushalp/82178355162adce1876ad46041d2fc6f to your computer and use it in GitHub Desktop.
Save kaushalp/82178355162adce1876ad46041d2fc6f to your computer and use it in GitHub Desktop.
URL Rewrite rule to redirect from HTTP to HTTPS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="HTTP/S to HTTPS Redirect" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{SERVER_PORT_SECURE}" pattern="^0$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment