May 12

0 comments

Using a 301 redirect to avoid search engines seeing duplicate content.

By Christopher Mendla

May 12, 2012


Last Updated on September 21, 2023 by Christopher G Mendla

Before you begin, be aware that errors in your .htaccess file could result in an unreachable site or loss of traffic.

It is important to ensure that search engines do not see duplicate content on your site. This can result in a penalty or dilution of your traffic. One of the more common errors is to not redirect your example.com traffic to www.example.com or vice versa. In other words, the search engines begin to believe you have two identical sites.

One site that will tell you if you have this problem is http://www.pearanalytics.com/  . You simply enter your site’s address and it will provide some basic, but important SEO information.

If your site is hosted on an Apache server, you can fix this with a few  simple lines in your .htaccess file. If you are running Joomla, you should have an active .htaccess file anyway.

To do this, you should

  • Back up your existing .htaccess file. You should already be familiar with the .htaccess file and editing files using an FTP client such as Filezilla.
  • Open the .htaccess file for editing.
  • If you are using Joomla and the .htaccess file provided by the Joomla installation, you should see an area about redirecting non www pages to the www.pages.
  • Post the code below in AND modify it to reflect your site name.
  1. RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
    RewriteRule .? http://www.example.com%{REQUEST_URI} [R=301,L]
  •  NOTE – you only have to have the RewriteEngine On line once.
  • Now TEST your site including any administrative back ends.
The site below gives some more detail as well as a means of changing the .htaccess files for frontpage and microsoft based servers.

http://www.pearanalytics.com/blog/2010/implementing-a-proper-301-redirect-on-apache-or-windows-servers/

Christopher Mendla

About the author

Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}