Skip to content

Instantly share code, notes, and snippets.

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