Quantcast
Channel: Craig Harris » SEO
Viewing all articles
Browse latest Browse all 9

Avoid duplicate content from index.html or index.php

$
0
0

Todays SEO post is a quick and easy one to avoid duplicate content.

http://www.craigharris.org

http://www.craigharris.org/index.php

Both this links return the same page and would be considered duplicate content by Google. To fix this include the following bit of code in your sites .htaccess file:

RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]

If your site uses a .HTML main page use this:

RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]

This will redirect all requests for the index page to the directory root avoiding duplication. If you have more RewriteRule lines in your .htaccess file you can remove the L at the end.

Read my previous article on duplicate content with the WWW sub-domain here: http://www.craigharris.org/2011/03/18/to-www-or-not-to-www-that-is-the-duplicate-content-question/


Viewing all articles
Browse latest Browse all 9

Latest Images

Trending Articles





Latest Images