To WWW or not to WWW

From the Gospel according to Paul Maden

To WWW or not to WWW, that is the question.

For many people a website address must begin with www, always has done, always will do. Sure, there’s an old technical reason for it, probably also a good marketing reason (hear “www” on a radio or tv ad and you know it’s a website address).

But the truth is the www is not required. Many hosting accounts allow a site to be reached without typing the w’s. Take my local radio station “2BR” for example, both 2br.co.uk and www.2br.co.uk take you to the same content. And that’s fine, some people will type the w’s and some won’t.

So what’s the problem?

Search engines rank a website by (amongst other things) counting the number of other sites that link to your site. If your site is visible at two (or more) separate addresses other sites may not know which one to link to, so some may point to the “www” and some to the “no www”. This has the effect of diluting your ranking between the two different addresses.

Search engines also employ techniques to filter out duplicate content (identical content found on multiple pages) – which means they may favour one of your site addresses at random, not necessarily the one you want.

The solution is usually quite easy, by simply adding a 3 line text file to your site you can redirect one name to the other. Let’s say you want to redirect the “no www” name to the “www” name.

Simply create a text file called “.htaccess” with the following content and save it in the same folder as your home page…

To redirect visitors (and search engines) to the “WWW” version:
RewriteEngine On
RewriteCond %{http_host} !^www\.2br\.co\.uk$
RewriteRule ^(.*)$ http://www.2br.co.uk/$1 [L,R=301]

Or, to redirect to the “No WWW” version:
RewriteEngine On
RewriteCond %{http_host} !^2br\.co\.uk$
RewriteRule ^(.*)$ http://2br.co.uk/$1 [L,R=301]

Pay attention, here comes the science bit…

Line 1 – Instructs your web server to switch on a special feature called URL rewriting, which allows incoming requests for pages to be modified in various ways before sending the page back to the visitor.

Line 2 – Tells the server to watch out for requests coming in where the domain name doesn’t match the name we specified.

Line 3 – Sends a message back to the user’s browser (or the search engine) that the page they requested has moved, and can now be found at a new address. If a user requested the page their browser will automatically redirect to the new address. If a search engine requested the page, it will then update its records with the new address of the page.

So, using this technique users and search engines will be alerted to your preferred domain name, allowing you to use different domain names whilst preserving your search engine rankings.