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.

IIS Create WebSite Wizard - 1

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:

IIS Host Header

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).

IIS Redirect

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

Author

Jason Prothero

Jason leads the team at ProWorks Corporation, an Umbraco Platinum Partner specializing in complex Umbraco CMS builds, integrations, support, and upgrades. With 17+ years of Umbraco experience and an Umbraco MVP, he has led dozens of successful projects from versions as old as Umbraco 4 to the latest Long-Term Supported (LTS) releases. Jason is also leading the charge at ProWorks around AI and how to responsibly integrate AI into Umbraco and websites to create ROI and not simply as a novelty.

comments powered by Disqus
back to top