.NET Articles, Web Devploment, ASP.NET, HTML, Sharepoint 2010, Aamir Hasan
Advertise Here
Advertise Here
Advertise Here
Advertise Here
Advertise Here
Advertise Here
Advertise Here
Advertise Here
Advertise Here



Posted by Aamir Hasan   on Monday, October 10, 2011 Total Views:  

In this article, I will demonstrate how to redirect non-www domain to www domain. When user writes or both will open the same content but search engine will treat as two different domain and rank as both domain name if some one visit your site with non-www or www domains. URL rewrites 2.0 gives you canonical domain name rule template that will resolve canonical hostname in your web site. I will extend my previous article IIS 7 URL Rewrite Module 2.0 – Convert to lowercase URL. Let’s start.

Step 1: Open your IIS 7, expand your IIS Sites node, click on your desire website and double click on URL Rewrite extension.

Step 2: Click on Add Rule(s) link from right pane.

Step 3: From Search Engine Optimization (SEO) section click Canonical domain as shown in below.

Step 4: “Add a rule to redirect to a canonical domain name” dialog box will appear and select the primary host name as shown.

The following new created rules shows you in below figure.

Note: this rule force to redirect to

The following rule will add in your Web.Config file as shown.


        <rule name="CanonicalHostNameRule1">

          <match url="(.*)" />


            <add input="{HTTP_HOST}pattern="^www\.domainname\.com$negate="true" />


          <action type="Redirecturl="{R:1}" />



Protected by Copyscape Online Plagiarism Tool

Comments (1) - Czech Republic
7/25/2012 8:40:10 PM #

good information

Add comment

  Country flag

  • Comment
  • Preview

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5