The Chillidog Software Blog

The ramblings of a developer

Duplicate content in RapidWeaver

We've talked about how GZip and CSS stylesheets affect the look and performance of your site. What if I told you, however, there is a sneaky little "gotcha" that, if it goes unchecked, can hurt your SEO. This "gotcha" is referred to as duplicate content.

What is Duplicate Content?

Duplicate content is, as the name suggestions, content that has been found on your site at multiple locations. Moz illustrates this the best here showing the same content at different URLs. We will, however, examine a very simple case. We will look at your site with and without the "www" in the URL. For example,

http://www.chillidogsoftware.com // With 'www'
http://chillidogsoftware.com // Without 'www'

The lack of may www seem innocent enough but, if not handled properly, search engines will consider these as two different URLs and two different pages.

How do I know if I am affected by Duplicate Content?

A simple test on your home page can catch a common cause of duplicate content. Simply try to visit your URL with and without the www. If you're not consistently redirected to one URL, then you're affected. For instance, let's look at chillidogsoftware.com. If you visit http://www.chillidogsoftware.com or http://chillidogsoftware.com you'll notice that, in both instances, you're redirected to the URL http://www.chillidogsoftware.com!

Does it matter if I use www or not?

Absolutely not. It does not matter. The only thing that matters is that you're consistent. You must choose one and stick to it.

How do I fix Duplicate Content?

In this instance, Duplicate Content is easy to fix using a .htaccess file. Using the code below, we will force users to always use the 'www' version of our site.

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Source

If you'd rather force users to use the 'non-www' of your site, the .htaccess code would be:

RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Another set of tricks courtesy of css-tricks:

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

or to remove www:

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

This second set of .htaccess tricks require you to update them as appropriate for your domain. Please be sure to replace your-site.com :)

Now you're ready with some .htaccess tools to fight Duplicate Content! This code will need to be added to each of your domains. This includes any add-on domains you may have. Since there is a personal preference of www or non-www, hosts can not do this automatically for you (trust me, I thought about it for Chillidog Hosting).

Your top dog, Greg