Redirecting WWW via HTACCESS

Maybe you have seen it before, maybe not. But the same website can have 2 different PageRank’s. I am talking about the url with “www” in front and the url without the “www” in front.

Example: has pagerank 5 has pagerank 3
This is a thing that you see alot (if you check it ofcourse). Most people only check the pagerank with the “www” part in front of the domain. But sometimes the domain without the “www” part can have a higher pagerank.

How is this possible?

Google thinks those examples I have given above are 2 different websites. And will give them each its own rank. That’s the reason I am sharing this with you. It is important to let Google know which url is the most important. and point the less important one to the most important. You can do this with a permanent redirect with the use of a .htaccess file.

I wanted to keep the “www” in front of my url. Try to type in your browser my blog without the “www” part. Than you will be redirected to the url with the “www” part.

It may eventually pass true rankings to the url you want to keep. I mean, when your url without the “www” part has a pagerank of 5 and the url with the “www” part has a pagerank of 3. The 2 url’s are becoming 1, and will give his rankings on the 1 were it is redirected to.

The Code:

Create a .htaccess file with the below code, it will ensure that all requests coming in to will get redirected to The .htaccess file needs to be placed in the root directory of your website (i.e the same directory where your index file is placed), and CHMOD it with 777.

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]

REPLACE and with your actual domain name.

That’s it. If anyone has troubles or questions about this, don’t hesitate to contact me, or leave a comment.

Leave a Reply

Your email address will not be published. Required fields are marked *