How can i avoid duplicated index page using mod rewrite?

Nowadays a SEO is important for a good ranking in search engines.

Google and many other search engines can tag your index page as duplicated if they find that the same page is showing when they go to:

http://www.yoursite.com

or

http://www.yoursite.com/index.html (or index.php, etc.)

To avoid this you can use the following rewrite rule in your .htaccess file:

RewriteEngine On
# Remove index.
RewriteCond %{THE_REQUEST} \ /(.+/)?index(\?.*)?\  [NC]  
RewriteRule ^index.html$ http://www.yourdomain.net/%1 [R=301,L]
Was this answer helpful? 1 Users Found This Useful (711 Votes)