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

This similar to the www vs non-www version of your site work-around.

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 that all requests to index.html should be directed to the "/" (slash only).

Note: in the example rule, you will need to change www.domain.com to your own domain or domain.com if you are not using the www.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Force SSL/https using .htaccess and mod_rewrite

Sometimes you may need to make sure that the user is browsing your site over a secure...

Apache mod_rewrite and Examples

What is mod_rewrite? Mod Rewrite allows you to change the URL that everyone sees when they visit...