Created
April 21, 2016 15:58
-
-
Save alindgren/1d4585e75abde1e84595f4d0c25eeac5 to your computer and use it in GitHub Desktop.
HTTP to HTTPS redirect rule config transform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 --> | |
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> | |
<system.webServer xdt:Transform="InsertIfMissing"> | |
<rewrite xdt:Transform="InsertIfMissing"> | |
<rules xdt:Transform="InsertIfMissing"> | |
<rule name="HTTP to HTTPS redirect" xdt:Locator="Match(name)" xdt:Transform="RemoveAll"/> | |
<rule name="HTTP to HTTPS redirect" stopProcessing="true" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing"> | |
<match url="(.*)" /> | |
<conditions> | |
<add input="{HTTPS}" pattern="off" ignoreCase="true" /> | |
<add input="{HTTP_HOST}" pattern="localhost" negate="true" /> | |
</conditions> | |
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" 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