Fixing Duplicate Content SEO Problems in Drupal

Having duplicate content is a major problem for search engine optimization (SEO). To put it simply, by having multiple copies of the same content online, you’re competing against yourself for search result rankings. And Google has also been explicit that duplicate content on your site may result in lower search ranking. Avoiding this penalty is important for maximizing your site's search rankings, however, Drupal's default configuration can often lead you to unknowingly create duplicate content. Read on to find out how to fix this issue.

The Problem: Drupal's URL Path System Causes Duplicate Content

In general, it’s pretty easy to avoid showing content more than one place, but Drupal users need to pay special attention to the way URL paths are managed. Let’s take a made-up example: a page called "My Puppies" on the site http://www.example.com. We'll assume that the page’s internal Drupal path is “node/10”, and we’ve given it a friendly path alias of “my-puppies”. With the default configuration of Drupal, this page will now visible at ALL of the following URLs:

http://www.example.com/node/10
http://www.example.com/node/10/
http://www.example.com/my-puppies
http://www.example.com/my-puppies/
http://www.example.com/My-Puppies
http://www.example.com/My-Puppies/
http://example.com/node/10
http://example.com/node/10/
http://example.com/my-puppies
http://example.com/my-puppies/
http://example.com/My-Puppies
http://example.com/My-Puppies/

That’s TWELVE different pages with exactly the same content, all from only one node. And it could be even more, since any variation in capitalization ("/mY-pUppIES", "/My-puppiES", etc.) will also load this page. Luckily, this problem is relatively easy to fix by doing the following two things.

Step One: Edit Drupal's .htaccess file to redirect all users to a single domain.

The .htaccess file that comes with Drupal is located at the top level of the website folder tree. (with index.php and update.php) In this file, there is a disabled section of options that looks like this:

 
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] 

Pick one of the domain options by deleting the # in front of the two associated lines, and don't forget to actually put your own domain name in there. So, on this website we use:

# RewriteCond %{HTTP_HOST} ^www\.zengenuity\.com$ [NC]
# RewriteRule ^(.*)$ http://zengenuity.com/$1 [L,R=301]

You have now eliminated half of the duplicate URLs in the list above.

Step Two: Install and Enable the Global Redirect Module

The Global Redirect module does three things for you. First, it will automatically remove any slash at the end of a URL. Second, it will redirect any URL that has different capitalization to the URL address that you actually selected. So, http://www.example.com/My-Puppies will automatically redirect to http://www.example.com/my-puppies. Finally, Global Redirect will ensure that anyone accessing the original internal Drupal path (http://www.example.com/node/10) gets redirected to the path alias that you created.

Conclusion

After editing .htaccess and enabling Global Redirect, you will be left with a single URL for this content:

http://www.example.com/my-puppies

Every other variation of the URL will be redirected to this address with search engine friendly 301 redirects. By following these guidelines, you will eliminate the duplicate content that is generated by the Drupal system itself and take a big step towards maximizing the search engine ranking of your site content.