This article applies to IIS6, but the concept applies to almost any public website. You should probably setup a 301 redirect from http://example.com to http://www.example.com (or the other way around). If you don’t, bad things can happen. Anyway, here is how you can do it in IIS6:
Instructions
Create a new website with the same IP and host name as your main website, but do not include the www. FYI, I think that IIS will yell at you if you try and create 2 websites with the same IP and host name. I add “redirect” to the end of mine so that I know it’s the redirect website.
Then, in the “Home Directory” tab of the redirect website:
- Check the radio button that says “A redirection to a URL”.
- Enter in your domain like this, without the double quotes: “http://www.example.com$S$Q”
- Check the box that says “The exact URL entered above”.
- Check the box that says “A permanent redirection for this resource”.
Now I would test that the non-www version of your website redirects to the www version. If you want to be 100% sure what is happening, look at the Net tab in Firebug or the Network tab in the Google Chrome Web Inspector.
Caveats/Debugging
If your company manages your internal DNS, you might encounter an issue resolving some of the hostnames internally. For example, at the time of writing, “http://example.com” doesn’t work from inside our corporate network! It’s not a big deal, but in our case it times out so it might give the illusion that the website is down.

