Canonical Issues on Windows

If you are looking to make sure your site is as optimized for search as it can be, you have probably been told to do a redirect from your non-www domain to your www domain. This is not too difficult when you are hosted on Linux, but can be a little more tricky when you are on a Windows based hosting plan. Even more troubling if you are on shared Windows hosting. Here is a quick how to if you are leasing a Windows based server and have IIS access.

The method below will do the redirect without any additional software such as ISAPI Rewrite. I am not saying you shouldn’t purchase and install ISAPI Rewrite. I am just looking to provide an install free method.

I will use example.com as the domain name in the how to. Obviously this is where your site name needs to go. This will allow requests for http://example.com/mydirectory/detail.cfm?myid=555 to be 301 redirected to http://www.example.com/mydirectory/detail.cfm?myid=555.

  1. Log into your server
  2. Open IIS Manager
  3. Right-click the site you wish to modify and choose Properties
  4. In the Web Site tab, under the Web site identification section, click the ‘Advanced button’.
  5. Under Multiple identities for this Web site, make sure there is a Host Header value for the ‘www’ version of your domain name (www.example.com). Make sure there is no value for the ‘non-www’version of your domain name (example.com)
  6. Click OK and go back to the IIS Manager
  7. Create a new web site. In the Web Site Creation Wizard enter the following values:
    1. Description: Enter a description such as ‘example.com Redirects’ (remember to always comment your code too)
    2. IP Address: The IP assigned to the domain in its DNS record
    3. Tcp Port: 80
    4. Host Header: Enter the ‘non-www’ version of your domain name (example.com).
    5. Home Directory Path: Can be the same as your current site for now.
    6. Permissions: Can be the same as your current site.
  8. Right-click the new web site and choose Properties
  9. On the Home Directory tab, under ‘The content for this resource should come from’, choose A redirection to a URL.
  10. In the Redirect to field, enter http://www.example.com$S$Q where example.com is your domain name
  11. Under The client will be sent to, check the box next to The exact URL entered above. Also check ‘A permanent redirection for this resource’

That should do it. Don’t forget to test, test and then test again.

3 thoughts on “Canonical Issues on Windows”

Leave a Reply

Your email address will not be published. Required fields are marked *