Published On: July 13, 2015
Author: Eric Oliver

WWW or no WWW

WWW or no WWW

When you go to a Website do you type WWW or do you leave it off and go straight to the domain? If you are a frequent user of the Internet you probably said that you do not use the WWW. You are not alone. Many experienced users do not include the WWW just because it is quicker. This may seem like an easy answer, and technically it is, but beyond web programmers and developers the real reason behind the use of WWW is not well known.

When you design a site you need to account for the use of the WWW or the WWW-less URL. According to many developers around the world, the WWW is depreciated. There is no need for the WWW anymore….I am one of those developers that think like this, so I may be biased to which one I prefer. While the URL may look the same to a typical user, it is not to a search engine. Some search engines can treat the WWW as a sub domain and it may knock your Website down a few notches because of duplicate content. For example, while I was doing research for this blog post I found a site that listed Digg as one of the offenders…so it is not limited to small websites. Even the big boys get it wrong occasionally.

In this article we will help you get your site setup with either a non-WWW URL or with a WWW URL. Even though I am biased, I will demonstrate the proper way to do it either way to prevent your site from being flagged for duplicate content. Canonicalization is a very important process that every developer should consider. Take a look at the following example:

  • www.testsite.com
  • testsite.com
  • testsite.com/home.html
  • www.testsite.com/home.html

in the average user’s eye they are the exact same location, especially if the developer did not account for canonicalization. Technically, to the above average users and search engine spiders you are looking at 4 different URLs. They may bring you to the same place, but they are all different. Search engines pick the best URL that represents the site….so 3 out of the four will hurt your ranking.

How Do I Fix It?

The fix for this is very simple and requires you to edit the .htaccess file. This will help you from having to edit every file on your site. So enjoy.

If you prefer to use the non WWW way you can use this:

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

If you prefer to use the WWW way you can use this code:

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

Posted In: htaccess, Ideas


About the Author

Eric Oliver

Director of Website Development

With over a decade of experience designing and developing websites, Eric has worked in every position of the agency ladder. He is fluent in multiple backend and front end programming languages and has written multiple international best selling plugins for WordPress. He has been part of or is still part of many startups. He is the Director of Website Development for Future Design Group and one of it's founding partners.