The Google www versus non-www versions of the same domain names issue has plagued many websites much to the chagrin of the webmasters and Internet business owners. In a nutshell, this means that Google sees www.yourdomain.com and yourdomain.com as two different websites with different pages that don’t perfectly match and penalizes the site for having duplicate content.
If you are familiar with the duplicate content penalty in regard to unrelated websites, this www versus non-www issue is a duplicate content penalty within the same website. So, how do you tell if this is happening to your website?
The first indication is usually that a website is fully indexed by the search engines but is buried in the rankings and fails to be unburied within a reasonable amount of time. If you have a website that has been around long enough to escape the Google Sandbox, but still languishes at the depths of the rankings wormhole, then it is worth checking to see if your website may have this problem.
The easiest way to check is to go to Google and type in site:www.yoursite.com and check the number of results listed. Next, type in site:yoursite.com (and of course substitute the name of your actual site for “yoursite”) and see if the number of results match.
If the number of results do not match, you site most likely has this www issue going on. If the results match, you may or may not have the www issue as well. Conventional SEO wisdom has stated that if the numbers match, then you do not have the www problem. But, through my own experience, I have tested a number of sites and found that some will have the number of results match, but the pages in the results are not identical, and thus the www issue is present.
So, if you do have the www issue, how do you fix this problem? Typically, you can fix this issue through the htaccess file, which works most of the time. The simplest fix is a 301 redirect from yourdomain.com to www.yourdomain.com and that may work fine for you. This simple fix, however, does not work in all cases.
Another fix to use in the htaccess file is to use a mod rewrite that interacts with your webhost’s server.
Here are three versions that I’ve used with success of different occasions.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.yourdomain.com$
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*).yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
Experiment to see which one will work for you. If you page won’t load after using one of these, simply remove the htaccess file and try another one. If none of these works, and interferes with the functioning of your website, remove the new htaccess file and reinstall the old one if you were using one.
Some people have gone to the extreme of moving their website to a new domain name and doing a site wide 301 redirect from one domain to the next. This should be done only as a last resort. If this is the route you choose, then put a moratorium on changes for several weeks while making this transition.
The best case scenario is moving one identical website that the search engines have already indexed to a new domain, do the 301 redirects and give the search engines a couple of weeks to fully index this identical website sitting upon the new domain name.
If you make changes during this time, it may affect your search engine results and Page Rank. If you do everything right, however, your site still may suffer in the rankings so patience will be needed.
These are the basics of the Google www versus non-www issue. Whether you are working with your own sites or client sites, this is one issue that will need to be checked especially for sites that are fully indexed but not ranking well.