I'm using IIRF on an IIS 6.0 server to redirect users from a "www" version of the site to a "non-www" version using the following code:
RewriteCond %{HTTP_HOST} ^www.mydomain.co.uk [NC]
RewriteRule ^(.*)$ http://mydomain.co.uk/$1 [L,R=301]
However, I have to create a file with this code in the root of the website, and I have quite a lot of different websites and domains to add this to file too. Is there any way of making the code above generic, so that even though the file will still be created in each website folder (as this is easy to do with the content management system), that I don't actually have to specify the domain name and it would still redirect the user from "www" to "non-www"?
Thanks
Mark
This is what I use...