Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ASP.NET - Remove www prefix with 301 redirect to root domain.
<rewrite>
<rules>
<rule name="Remove WWW prefix" >
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.domainname\.co.uk" />
</conditions>
<action type="Redirect" url="http://domainname.co.uk/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment