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:
- http://www.mydomain.com has pagerank 5
- http://mydomain.com 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. Thats 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 mydomain.com will get redirected to www.mydomain.com. 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} ^mydomain.com [nc]
rewriterule ^(.*)$ http://www.mydomain.com/$1 [r=301,nc]
REPLACE mydomain.com and www.mydomain.com 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.
Share: del.icio.us Reddit Google Netscape StumbleUpon Technorati


January 11th, 2007 at 8:28 pm
It’s very important to emphasize the damage that can be done when using a redirection to only one domain in terms of SE ranking and traffic.
Thanks for your how-to guide Nomar, nice post.
Allen.H
January 11th, 2007 at 11:11 pm
“It’s very important to emphasize the damage that can be done when using a redirection to only one domain in terms of SE ranking and traffic.”
One word can change the whole meaning, i actually meant:
“It’s very important to emphasize the damage that can be done when NOT using a redirection to only one domain in terms of SE ranking and traffic.”
Allen.H
January 11th, 2007 at 11:19 pm
hehe Allen, I didnt understand your comment in the first place, I assumed it was my fault because my main language is dutch.
Thank you for clarification
January 11th, 2007 at 11:52 pm
Checkout Google’s webmaster tools, too. You can set the preferred domain.
January 12th, 2007 at 5:08 pm
Dreamhost actually has this available when you set up a domain with them, so there is no need for a .htaccess file. However, in the event that I move hosts this will become very usefull.
January 15th, 2007 at 9:39 pm
is that true? i will try with www and without www
January 15th, 2007 at 10:10 pm
need some time to reach page rank and be patient
January 15th, 2007 at 10:10 pm
Will this make google add the links for both addresses when evaluating links?
January 17th, 2007 at 8:54 pm
Yeah I’ve been using this little trick for a while
January 23rd, 2007 at 8:09 pm
[...] In google’s eyes, that gives the split site, with both www and a non-www addresses allowed. The second method is to use Apache’s mod_rewrite module to redirect to the correct URL, like so (found here): Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^mydomain.com [NC] RewriteRule ^(.*)$ http://www.mydomain.com/1 [R=301,NC] [...]
January 24th, 2007 at 6:16 am
For my site, they’re one and the same. Both are PR3. Same with my blog.
January 24th, 2007 at 6:18 am
Oh, one thing that I forgot to mention, though, is that when you Google my name, the URL with the www pops up as the #2 result, whereas the one without is nowhere to be seen.
March 13th, 2007 at 11:54 pm
This is a fantastic idea! I’m so glad my buddy Mr. Gary Lee show this to me!
April 6th, 2007 at 12:34 am
Hey I was just looking for this solution, thanks…but it only redirects the root url. So mysite.com goes to http://www.mysite.com, but what about directories etc. How do I get mysite.com/forum/topic14 to go to http://www.mysite.com/forum/topic14? Thanks!
May 15th, 2007 at 4:40 pm
hi there
, a question for you guys….
there’s a way to redirect a not found subdomain to a 404error page??? i mean, if somebody type “http://anything.mydomain.com”, should appear something like
“Not Found
The requested URL “http://anything.mydomain.com” was not found on this server.”
any advice will be appreciated
-TuroxOS
June 10th, 2007 at 7:43 pm
Hi I want to ask a question about this issue.
I have just used 301 redirect but according to some SE there are different backlink with www and without http://www. Is This situation effect my PR? Or
using 301 redirect fix about my PR issue.
I think next update Pr with www will be different from without http://www.?
Thank you very much..
March 25th, 2008 at 7:37 am
Thanks for the tip. An online website grader flagged my site on this. BTW I’m new to editing htaccess but shouldn’t the 2nd line end with an [r=301,L]instead of NC? I guess it would be OK as long as you don’t have anything else below it in your .htaccess
October 27th, 2008 at 4:34 am
I think the CHMOD for the .htaccess file should not be 777 : that’s very unsafe because everyone (the group and the world can re-write it).
IMO it should be 644 (the owner can read + write; the group can read; the world can read).