Redirecting index.php to Root using htaccess

How to redirect index.php to root... One of the ground rules for successful SEO is to have only one url for each page. We need to combine all the Google PR and link power into one url. Typically, the index page can be accessed by both domain.com/index.php or domain.com/index.html as well as domain.com.

Where is the index.php link used on a website - Many people have a link on the home button as <a href="/index.php">. This should be <a href="/">. So in reality, there should never be any links into either index.php, nor index.php.

However, should such links exist, or as general good practice, there should be a redirect back to the root if ever such a link happened to exist.

.htaccess file - in the root directory
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.domain.com/$1 [R=301,L]

Refer to the Redirect check tool for an answer specific to your site.

Tags: