Created
March 4, 2016 16:40
-
-
Save greggnakamura/754d8f68c8b0c84cb2c9 to your computer and use it in GitHub Desktop.
web.config: Add 'www' to HTTP or HTTPS
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"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="Add www to HTTPS" stopProcessing="true"> | |
<match url="(.*)" /> | |
<conditions> | |
<add input="{HTTP_HOST}" pattern="^www\.site2\.com$" negate="true" /> | |
<add input="{HTTPS}" pattern="On" /> | |
</conditions> | |
<action type="Redirect" url="https://www.site2.com/{R:1}" /> | |
</rule> | |
<rule name="Add www to HTTP" stopProcessing="true"> | |
<match url="(.*)" /> | |
<conditions> | |
<add input="{HTTP_HOST}" pattern="^www\.site2\.com$" negate="true" /> | |
<add input="{HTTPS}" pattern="Off" /> | |
</conditions> | |
<action type="Redirect" url="http://www.site2.com/{R:1}" /> | |
</rule> | |
</rules> | |
</rewrite> | |
</system.webServer> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment