Yes WWW! No WWW!

April 10th, 2007

Most websites on the Internet can be accessed using both just their domain name and the www subdomain and domain name. For ex: www.example.com and example.com may lead to the same website. Some search engines consider the www version and the non-www version to be seperate websites and assign different Search Engine Results Page (SERP) positions and or page rank to them. This often results in a split page rank where the non-www and www versions of a site have different page rank. To prevent something like this from happening it helps to canonicalize your website URL. This means that you should select one version as a standard and redirect from the other to it.

But which version should you choose? One option is to use the version that has the most backlinks. But there are some advantages to each version.

Using the non-www version has these advantages:

  • It results in a shorter URL. example.com is shorter than www.example.com. This means that it is easier to type.
  • It is easily recognised as a URL by the tech savvy generation. Increasingly non-www versions of their sites are being advertised by companies.
  • www is redundant from a purely technical point of view if both the www and non-www version of a website contain the same content and are served by the same server. There is no reason why you should have to include www in a URL to connect to a website. Just the domain name suffices as modern browsers automatically prepend http:// and connect to the right port.

If you wish to normalize your URL to the non-www version i.e. redirect traffic from the www version to the non-www version use the following code in your .htaccess file:


#redirect from www to no-www

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

Using www in the URL has these advantages:

  • It makes it easier for the general public to recognize a website address. This is especially important if you are using an unusual top level domain name. For example it is easier to identify www.example.info than example.info as a website address. Another way of looking at is that www may perform the function of punctuation marks.
  • In most forms of Internet communication URLs that include www are automatically converted into live links. This is the case in forums, email clients and also most blog software. Non-www URLs need to include http:// to be converted into links. This defeats the purpose of a shorter URL.
  • Most major websites still prefer the www version over the non-www version. That is they redirect from the non-www to the www version. Some also use www and other subdomains to distribute the load among different servers. For ex: www1.example.com www2.example.com

If you choose to redirect traffic to the www version of your site use the following code in your .htaccess file:


# redirect from no-www to www

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www [NC]
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]

Once you have chosen one standard for your site and implemented a redirect as shown above, you and your users can freely link to your website using either the www version or the non-www version as all the benefits of an inbound link will pass to the URL you are redirecting to. If your website’s page rank is currently split it will be unified in the next page rank update.

You can use the above code in your serendipity blog as well. If you are currently using mod_rewrite URL rewriting to create Search Engine Friendly URLs the line "RewriteEngine on" will already be present in your .htaccess file. You can add the rest of the code just after that line.

I am currently using a redirect to non-www for all my s9y blogs including this one. However since I have learnt more about this subject I feel it is a good idea to implement a redirect to www for future sites that have unusual TLDs like .info while favouring no www for sites that have common tlds like .com.

One Response to “Yes WWW! No WWW!”

  1. Signupandmakemoney says:

    Hey, thanks for the .htaccess code. I used it on my website, but I used it in a subdirectory of my site.

    RewriteRule (.*) http://www.%{HTTP_HOST}/forum/$1 [R=301,L]

    I just appended the forum directory to it and it worked. I was just wondering though, when I mouseover the link it still shows the url with no www. Once I click on the link, then it shows up on the browser with www appended.

    I have a 3rd party script automatically changing the urls and it doesn’t add www. to topics and boards, everything else has www.

    I know it sounds strange, but how can I override the script?

    Posted on 20 Jul 2009 Reply

Leave a Reply

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