ISAPI enforce www. domain

Following on from my other post about URL Tips for asp.net websites, here is another good little ISAPI rule which I got from Receptional.

I used to set up the non www. domain to 301 redirect via IIS which is a pain as you then have two unnecessary entries.  This solves the problem :)

RewriteCond %{HTTP_HOST} !^(www\.yourdomainname\.co\.uk)?$
RewriteRule (.*) http://www.yourdomainname.co.uk/$1 [R=301,L,CL]

I’ll keep trying to add ISAPI nuggets as and when I find them, mainly for my own future reference.

Post a comment