Enforcing a canonical domain in IIS for SEO performance

If your site is focusing on SEO performance, it is important to have 1 url for each page. 

ie. suppose there are 2 ways of reaching your home page via:

http://mydomain.com.au/home

http://www.mydomain.com.au/home

This will effectively split the weight of your home page in half meaning the search engine will think it is half as important as it should be when ranking your home page.

The easiest way to resolve this is via the IIS url rewrite add on. This add on will achieve this behaviour across the board and prevents the need for a fix in the application level.

The steps are as follows:

1. Install the iis url rewrite addon: http://www.iis.net/downloads/microsoft/url-rewrite

2.   Highlight your site in the left panel then select url rewrite

3. Choose "add rule" from the right panel -> select canonical domain name -> set the primary host name to www.mydomain.com.au -> hit ok.

4. Done!

Now when a user visits http://mydomain.com.au/home, IIS will do a 301 permanent redirect to http://www.mydomain.com.au/home effectively telling search engines http://mydomain.com.au/home doesn't exist, and to replace references with http://www.mydomain.com.au/home.