How to Setup a Non-WWW to WWW Redirect in IIS 6
Most internet users practice and expect www in URL's whether typed into an address bar, linked in an email, or given via word of mouth. Some have broken free from this and learned including www is not always necessary. User-friendly websites take this into account by allowing access using the both options. Three examples include bing.com, google.com, and yahoo.com. Click on any of these three non-www links and notice the browser loads the appropriate website with "dubs." If your looking to establish a non-www to www redirect for this purpose or to maintain good search engine and website practices, here are instructions for websites hosted with Internet Information Services (IIS) version 6. First, create the non-www IIS website. The host header for this website needs to be domain.com, without the “dubs.” For this website’s Home Directory, choose “A Redirection to a URL” and enter a value of http://www.domain.com$V$Q. The $V$Q argument after the domain will collect and redirect additional path information such as directory and file name. Lastly, for “The client will be sent to,” select “The exact URL entered above” and “A permanent redirection for this resource”. This website will receive non-www requests and send them to the www website. Second, create the www IIS website. The host header for this website needs to be www.domain.com, with the “dubs.” For the website’s Home Directory, choose “A directory located on this computer” and assign the appropriate directory. This website will receive redirects from non-www requests and from www requests, making it the de facto website of the two IIS websites. To get everything working, the website’s DNS needs to be updated. The primary A Record and the www A Record need to point to the IP address of the computer that IIS is installed in. Once the DNS has been updated and is propagated, the non-www to www redirect will work!