Skip to content

Instantly share code, notes, and snippets.

@alindgren
Created September 29, 2016 15:37
Show Gist options
  • Save alindgren/4da5332f1b0ddb27d2ced1015eba4847 to your computer and use it in GitHub Desktop.
Save alindgren/4da5332f1b0ddb27d2ced1015eba4847 to your computer and use it in GitHub Desktop.
Canonical Domain Redirect
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="CanonicalHostNameRule1">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.domain\.com$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.domain.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