WWW or no-WWW?


Webmasters often face this dilemma – to include www in front of their domain or to exclude it. This is an oft-argued about topic in many webmasters’ discussion forums. However, there are some advantages and disadvantages on both sides.

Advantages :
Not using WWW :

  • WWW is actually a subdomain. Would you like users to access your site using a subdomain?
  • WWW, as pointed out by No-WWW.org, is deprecated. There is no purpose of typing www into the address bar except following a premeditated custom.
  • Users have to type less into the address bat to access your website.
  • Long domain names look better without the www.
  • According to some, not using www has a geekyness or coolness factor associated with it.

Using WWW :

  • People tend to trust sites which use WWW. Many take a WWW at the front of the domain name to be a sign of reliability and trust.
  • Most of the biggest players in the web industry use a WWW before their domain names.

Disadvantages :

Not using WWW :

  • People tend to think that sites not using www are unreliable and unscrupulous.
  • Not using WWW presents some difficulties while load balancing. The most common load balancing setup involves duplicating the files and the databases across different servers and pointing the WWW subdomain to those servers using CNAME records. But according to DNS specifications, bare domain names cannot have CNAME records. So, what is commonly done is, the domain is pointed to the different servers using A records instead of CNAME records. This essentially results in load sharing, not load balancing. In this configuration, the user won’t automatically load the page from the least loaded server, instead the requested page will be randomly served by any of the server.

Using WWW :

  • There is actually no feasible disadvantage of using WWW. However, we can say that while requesting a page, using www, we actually have to type out 3 extra Ws, and those three extra Ws are sent to the DNS servers for resolving. However, in this age of gigabit communication, such things hardly matter.

Now you’ll have to choose what you should implement for you website: WWW or no-WWW. Here are the .htaccess codes for redirecting users from www to non-www URLs and vice versa :

Redirection Codes :

WWW to Non-WWW :

[sourcecode language=”text”]Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L][/sourcecode]

Non-WWW to WWW :

[sourcecode language=”text”]Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L][/sourcecode]

However, there is a common misconceptions about WWW/Non-WWW :

Q. Having both WWW and Non-WWW URLs valid is bad for SEO and will result in penalization.

A. This isn’t sufficient evidence to support this statement. Search engines like Google and Yahoo! have algorithms that are intelligent enough to know that www and non-www versions of a website are same. However, in some rare cases, it has been found that www and non-www versions of a page have different pageranks. So, it’s best to specify your preference (www/ non-www) using Google Webmaster Tools and direct all traffic to either www or non-www versions of your site.