Skip to content

Instantly share code, notes, and snippets.

@vgerbase
Last active August 6, 2017 14:47
Show Gist options
  • Select an option

  • Save vgerbase/7a901f85f4f3d9376ddea57e5af3a42a to your computer and use it in GitHub Desktop.

Select an option

Save vgerbase/7a901f85f4f3d9376ddea57e5af3a42a to your computer and use it in GitHub Desktop.
Remove WWW and ensure HTTPS in IIS. Require URL Rewrite module.
<system.webServer>
<rewrite>
<rules>
<rule name="Remove WWW and Ensure HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^(www\.)" />
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://mydomain.com/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment