How to avoid duplicate content using .htaccess

htaccessIf and has same content, Google will think it as duplicate content. However, you can use .htaccess to avoid duplicate content. Solution is to redirect your visitor to one of the domain, either with www or without www. The trick below is a simple yet effective way to avoid duplicate content on the same domain.

To avoid duplicate content using.htaccess, follow the steps below:-


  • Open you .htaccess file located at your public_html folder
  • Copy and append the code below to your .htaccess
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^$ [NC]
    RewriteRule ^(.*)$$1 [L,R=301] 
  • Save your .htaccess file and try to enter at your browser and it should be redirect you to automatically now.

Share this with your friends:-

Leave a Reply