How to 301 Redirect example.com to www.example.com in IIS
Most SEO experts say that when you have two or more domains or URLs that have duplicate content, then Google will penalize you. Google and SEO experts recommend that you use 301 redirects to tell search engines that you have duplicate content and to forward to the correct domain or url.
Generally in the Linux/Apache world that means modifying the .htaccess file to redirect example.com to www.example.com.
In IIS it gets a little more complicated, but isn't too bad. Here's an easy and effective way I've found to do it. This is assuming that you already have a website in IIS that is bound to www.example.com and example.com. I'll keep it pretty simple to minimize confusion. If you're an expert, scroll down for the good stuff.
1. Open the Internet Information Services (IIS) Manager in Administrative Tools.
2. Create a new website that is bound to the example.com domain.
This involves right-clicking on the "Web Sites" folder under the server name in IIS and selecting "New > Web Site...". In the Web Site creation wizard name the site something like Example.com Redirect so you remember what the purpose of the site is.
Then make sure your host header for the new web site is the domain without the www. In this case we will use example.com:
Browse to the same location for the files as the www.example.com web site and allow anonymous access.
Finish out the wizard.
3.Change the Home Directory to redirect to the www web site.
Right-click on the new redirect web site and select "Properties...". Go to the "Home Directory" tab.
Change the content to point to "A redirection to a URL" and redirect to the www site (www.example.com).
Click OK and you should be done!
Now you won't get penalized by Google for having duplicate sites and your customers can still find you without typing in the www.
Anything I missed? Any comments?
UPDATE: For doing this in IIS7, take a look at this great tutorial: HTTP Redirection in IIS 7 on Windows Server 2008
UPDATE 2: If HTTP Redirection doesn't seem to be available in IIS 7, then follow this tutorial on how to install it: Install HTTP Redirection in IIS7