Skip to content

Instantly share code, notes, and snippets.

@MrAntix
Last active May 22, 2019 10:38
Show Gist options
  • Save MrAntix/6156413 to your computer and use it in GitHub Desktop.
Save MrAntix/6156413 to your computer and use it in GitHub Desktop.
Url rewrite to get rid of www. sub-domain, works on sub-sub-domains too
<?xml version="1.0" encoding="utf-8"?>
<configuration>
...
<system.webServer>
...
<rewrite>
...
<rules>
...
<rule name="Redirect from WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment