Skip to content

Instantly share code, notes, and snippets.

@vgerbase
Created August 31, 2017 14:40
Show Gist options
  • Save vgerbase/59b7cc3b5dccfb55fe85a0d73bf2f881 to your computer and use it in GitHub Desktop.
Save vgerbase/59b7cc3b5dccfb55fe85a0d73bf2f881 to your computer and use it in GitHub Desktop.
Ensure WWW in IIS. Require URL Rewrite module.
<system.webServer>
<rewrite>
<rules>
<rule name="Ensure WWW" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="www.mydomain.com" negate="true" />
</conditions>
<action type="Redirect" url="http://www.mydomain.com/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment