Prevent duplication of content using .htaccess

Friday, August 8, 2008 1:20
Posted in category SEO

Most domain names are accessible by http://domain.com and http://www.domain.com. Most webmasters don’t know that www. is actually a subdomain and can result in being punished by search engines because they see it as duplicate content.
To prevent this from happening, just copy paste the following code into your .htaccess file. In case your htaccess file already contains the RewriteEngine On entry, you do not have to add it again. However make sure to paste the code BELOW the RewriteEngine On entry. ( replace yourdomain.com with your site’s domain name. )

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]



Hope it helped!

Share/Save/Bookmark

Also read:

You can leave a response, or trackback from your own site.
Tags: htaccess, SEO

2 Responses to “Prevent duplication of content using .htaccess”

  1. iTechnoBuzz! says:

    September 29th, 2008 at 9:18 pm

    Thanx for the tut mate.. I used it and it worked perfectly.. :)

  2. Chetan(XC) says:

    December 14th, 2008 at 12:44 am

    WOW !! Thanx For This .. i was in need of this ;)

Leave a Reply


Comments links could be nofollow free.