Redirecting canonical names in IIS 7

Preface:  This procedure uses the domain for illustrative purposes only.  You will want to substitute for your own domain.  Also, if the images are too small, click on them to expand to full size.

When building a website, it is essential to plan for users that may try to access your site using www and non-www versions of your domain ( and  It is possible to just simply configure DNS to point both records to the same server and do nothing more, however this is not best practice.  Search engines that crawl your site will see two seperate sites with the exact same content, which can jeopardize your rankings.  Instead, we should be informing search bots to index the content at only one canonical URL.  We can accomplish this using a 301 redirect – this informs the bot that the URL to redirect from has permanently moved to the URL you are redirecting to (example: to  This has the benefit of not only streamlining future indexes, but also informing search engines to change URLs for already indexed content to the new URL.

So how do we configure IIS to redirect traffic?

First, we need to ensure the IIS URL Rewrite Module 2.0 is installed from the IIS Website.

Next, ensure that we have both canonical names configured on the same web site in IIS by right clicking on the site and selecting “Edit Bindings”:


You should see a list of your canonical URLs: If the URLs are not all present, click the add button to add a binding.  Type the domain name in the Host Name field, and click OK.  Repeat this step until all canonical names are configured, then click Close:


We then want to access the URL Rewrites plugin in the site dashboard.  Select Add Rule:


Scroll down in the window of available options, and select Canonical domain name.


If you want the www to always appear in the URL, select  If you do not want www in the URL, select


Click ok, and you will see the CanonicalHostName1 rule created.  Double click if you would like to view the parameters.


To test, open your web browser.  If you used as your main URL, type in the address bar and hit enter.  You should see the URL change to  If you used as the main URL, typing and pressing enter should change the URL to  If you use a tool such as Fiddler or Firebug, you’ll see the 301 Moved Permanently response, followed by a request for the main URL.

You have now successfully configured a canonical redirect.  Congrats!

Related Posts: Canonical Redirect with Apache 2

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>