Google sees
www.YourSite.com, YourSite.com, YourSite.com/index.php, and
www.YourSite.com/index.php as four different sites. The problem is that when your PageRank is split up into fourths, none of them will actually gain good results. Using mod_rewrite you can change all non-www URLs into www.
First create a .htaccess file (or edit the one you already have). You need to add the following code:
Code:
Options +FollowSymlinks All -Indexes
rewriteEngine on
rewriteBase /
RewriteCond %{HTTP_HOST} ^yoursite.com$
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [R=301,L]
What this does will do is tell the rewriteEngine to start looking for any incoming host that does not have the www. in front. You need to change yoursite.com to your actually domain. The it will add the www. for you. It checks to see if any other files were added, like yoursite.com/page1.php. If there was, it will add the www. in the front and also put the page1.php at the end. The R=301 says the redirection is a permanent one. This is the key for Google. It will ban you for having duplicate content, so doing a temporary redirect, a 302, isn't a good idea. Google could think that the page that's doing the redirection has the same content as the one it gets redirected to. The L says it's the last rule, don't bother looking for anymore and just redirect already.
I use this on almost all of my sites and my PR has been climbing ever since.