Saturday, December 01, 2007
« gingerbread house | Main | www. is depreciated »
posted by: Martin

For 'branding' (like I need that...) and for consistency and because I think it's kinda cool and old school like a classic car or something I wanted everyone that browses to criminale.com to get redirected to www.criminale.com. Here is what I did.

  • In IIS, I changed the name of my site to www.criminale.com.
  • In Properties > Web Site > Advanced I removed the criminale.com host header.
  • I then created a new site called criminale.com and for now pointed it to the same directory as the www.criminale.com site. The only host header for this site is criminale.com.
  • In Properties > Home Directory of criminale.com, I selected "A redirection to a URL".
  • In the Redirect to: field I put http://www.criminale.com$S$Q. More about that below.
  • I also checked the "The exact URL entered above" and the "A permanent redirection for this resource" boxes.

All done.

The $S tells IIS to take the subdirectory location e.g. /martin/cycling/training.asp and the $Q grabs the querystring. It seems intuitive not to check the "The exact URL entered above" box but if you don't you get a very different result.

Here is the Microsoft knowledge base article that I used as a guide:

http://support.microsoft.com/kb/313074