@Blog.Author(Nandip Makwana) .LearningExperience(ASP.NET, ASP.NET MVC, IIS, jQuery & Technology Surrounding it...)

August 19, 2011 comment , ,

IIS 7 : Redirect domain.com to www.domain.com

IIS URL Rewrite extensions enables web administrator to enforce powerful rules to transform complex URLs into simple and consistent Web addresses. As well it also helps to produce user and search engine friendly URLs.

In this post, we will examine how we can use IIS URL Rewrite extensions to redirect domain.com to www.domain.com. For more information on how to connect to remote website through IIS read my previous post. As we all know that by default we can access website with or without WWW. For e.g. browsing nandipmakwana.com and www.nandipmakwana.com will open same website. This means there are two different web addresses are available for one website and hence website’s SEO ranking will be distributed between these two addresses. To overcome these SEO ranking distribution, we can force all web traffic to redirect either domain.com or www.domain.com. Google web masters tool also allow web master to set preferred domain for indexing website URLs.

So conclusion is that redirecting all web traffic to only one primary domain or canonical domain can improve SEO ranking. Following is the step to achieve same with IIS.

Connect to website through IIS manager and click on URL Rewrite icon.

In Actions pane click on Add Rules.

In Add Rules dialog box click you can find several predefined rule template. Click on canonical domain name template under search engine optimization section.

It will open dialog box to select primary domain for website. Choose appropriate options.
Press ok. You have done it. Now all your web traffic will be redirected to primary domain you have selected. And you can see added rewrite rule in list pane. But just using predefined rule template is not enough for web administrator. We should also dig into rule settings done by this rule template. For examine settings of created rule select rule in list pane and double click on it or click on Edit Rules link in Action Pane.
It will open edit inbound rule window. Scroll down to bottom of window. There you will find Action sections. In action sections, there is one drop down named Action Type. Default value of Action Type is redirect. Expand Action Type drop down to see different actions available for this rule.
And below action type drop down there is another drop down Redirect Type. Default value of this is Permanent (301). Expand drop down to see list of available other redirect type.

Setting redirection type Permanent (301) will cause to send HTTP 301 status code and then after it will redirect to primary domain. So search engine can index appropriate URLs.
comments powered by Disqus

Featured Content

Resources & Tools

About Nandip Makwana

Nandip Makwana is passionate about digital world and web. He completed his Masters in Computer Application in June 2011. Currently he is working as a Software Engineer. He has shown great promise and command over ASP.NET and technologies surrounding it during his academic years and professorial life...continue reading