non-www to www with htaccess
I have a blog that has been PR4 for a really long time but I want it to be PR5. I have a half dozen sites that have a PR4 but none higher. I even have a ringtone landing page that is PR4!
One day while researching the links to the PR4 blog, I saw that the non-www page had a PR4 and the www version had a PR2! What’s up with that?
The problem is that I had been using the non-www in all my links when making a comment on other blogs. I knew it was time to consolidate and I decided to consolidate to the www version.
Google treats non-www and www as separate sites. They recommend using redirect to send all traffic to the URL you want to use. This will also redirect all domain variations to the domain of your choice (i.e. .us to .com, .cc to .com, .org to .com).
Here is the code that I use. Copy and past it in your .htaccess file (after changing the domain name of course:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yoursite.com
RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
And that is all there is!
Posted by Carl Thomas / Affiliate Preacher on August 6th, 2007
Comments(1)









Wednesday, December 12th, 2007 at 9:09 pm
Been using this for a long time on almost all my websites, helps reduce duplicate entries on search engines and increases the page value.
[Reply]