May
7
2009

Duplicate content fix index.html vs / (slash only)


This similar to the www vs non-www version of your site work-around.
As you might now you, by default you can access your site as http://www.domain.com/ and http://www.domain.com/index.html with some setups it can be index.php or index.asp or default.aps, etc.
Unfortunately, this creates a risk of duplicate content from the search engine point of view. To avoid this, you can use the following ModRewrite rules in your .htaccess file:

RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.domain.com/ [R=301,L]

The file should be located in your website main folder (web root).

The rules above will tell the browser or the search engine both that all requests to index.html should be directed to the "/" (slash only).

Related Posts

About the Author:

Hobbies: Reading books, listening to music, coding, robotics

Leave a comment


Domain Registrations starting at $9.98*

Categories

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

EverBot twitter