How to configure IIS 7 to redirect requests made to non-www domain to www domain?

by Peter Moss 7. March 2010 19:00

One of few legacy leftovers that was never dropped over the years is the common use of www domain prefix. It is not a problem per se for us humans, but SE bots have mind of their own. When traversing a non-www and a www version of a web site, apparently, google and other bots are treating them as two separate web entities, even if content is identical.

This causes confusion in SE databases and in a worst case a drop from the index.

To avoid this confusion, web site operators should redirect their non-www traffic to www version of the website, or redirect the www version to the non-www version of the site.

This should be done using 301 redirect, i.e. when request for http://example.com is made, the web server would return

HTTP/1.1 301 Moved Permanently
Location: http://www.example.com/


response with the location of the new site.

So how can I do this in IIS 7? Well, you have to edit web.config file, modify or add
the following section to its rewrite section.

<rewrite>
   <rules>
      <rule name="non www to www" enabled="true">
         <match url="(.*)" />
         <conditions>
            <add input="{HTTP_HOST}" negate="true" pattern="^www\.([.a-zA-Z0-9]+)$" />
         </conditions>
         <action type="Redirect" url="<a href="http://www.{HTTP_HOST}/{R:0"
>http://www.{HTTP_HOST}/{R:0</a>}" appendQueryString="true" redirectType="Permanent" />
      </rule>
   </rules>
</rewrite>

This should be your first rule.

The rewite section should be placed in system.webServer section.

Then just refresh your site and voila you have all trafic to http://example.com/* redirected to http://www.example.com/*

I wish SE bot developers would build this logic into their robots, but instead millions of webmaster around the world have to make the above configuration manually Yell

 

Tags:

Web

Comments

4/21/2010 1:23:33 PM #

Hi there, perhaps you could assist me? I saw you are using blogengine on your website. I lately decided to create a blog for myself and i am  making use of a wordpress blog. I read all about blog engine and i was thinking maybe you know where i could find good training or videos on how to use it properly? Thanks!

Vernon Renyer | Reply

4/27/2010 1:51:48 PM #

This document defines leading file share websites, their concepts and functionality, gives basic description of Rapidshare and its features, describes Rapidshare search engines, their workflow and how to benefit from using them, when searching for files and folders on Rapidshare.

Prior to describing Rapidshare search engines, get acquainted with this general leading file share websites services report. Just as other web users, you\'ve evidently heard about Rapidshare and similar-looking sites, invented to help people easily retail movies, mp3s, media, software and files via the internet. Created by German webmasters many years ago, Rapidshare quickly became the most popular file share service in the world, which led to invention of an english-language version used by above 200 million people from 240 countries of the world. As a result of popularity of this fileshare, first Rapidshare search engines appeared on web somewhat around a year ago. If you would like to share vacation photos with your friends, if you need to send documents and files to your colleagues bypassing mass e-mail distribution, just use Rapidshare to let everybody quickly and easily download all the necessary files from any computer connected to the Internet.

Besides this, you\'ve surely came across a lot of blogs and forums sharing media and other files over Rapidshare as well as Rapidshare search engines helping people to find necessary files there. It saves bandwidth and share necessary files among their visitors. Therefore Rapidshare is a handy, world famous file share service that helps people, companies, creators and others instantly share files via the Internet.

Nevertheless, there is one disadvantage. Rapidshare won\'t let you search for for files in their database. And despite of the fact that you know that a necessary file is almost definitely hosted on Rapidshare and you can download it, you can not find it, due to the fact that they miss a search engine.

That is exactly where Rapidshare search engines become handy. Rapidshare search engines are alike to web search engines with one important distinction. They don\'t index the Internet - they index Rapidshare, so therefore you always get download links without any unnecessary garbage. Just try Rapidshare search engine and you will most likely find all the files you need very quickly!

Now, let\'s examine popular types of Rapidshare search engines available on web. Basically we can outline three typical variants: classic, advanced and full-featured rapidshare search engines. Basic search engines offer just a couple of plain services. Their pages usually contain only a search string and popular keywords. That\'s it. You type a search term, click the Search button, get your results and try downloading a file. Most obvious disadvantage of services like this is that they don\'t display related files, they don\'t check the files for availibility and consistency and they fail to index other file shares, besides of Rapidshare. They can offer minimum services, but to tell the truth, they are not worth a penny. Other type crawls several Rapidshare search engines providing linked search term, tell whether the file is dead and propose similar and linked content. However, they don\'t offer you to search on other file share services and they miss essential features of top sites. Now quality Rapidshare search egines are offering you a maximum of services combining a lot of useful options and indexing almost all of the top Internet file databases, including Rapidshare.com. So it is questionless that you have to find a best Rapidhsare search egnine to get all you need from this type of websites.

Rapidshare | Reply

Add comment




biuquote
  • Comment
  • Preview
Loading