Alister Cameron // Blogologist

Changing the world. One blog(ger) at a time.

Pagerank with and without the ‘www’ – does it make a difference?

You wanna believe it does!

Check out the difference between icq.com and www.icq.com. The latter has a PR8 and the former? PR0!

I almost fell off my chair when I saw that. But I checked it twice and that’s what it is.

So what to do about it? For me, it meant deciding which I wanted (with or without the www bit) and then 301 redirecting from the one I didn’t want to the one I wanted using a .htaccess file. This is telling Googlebot and other search spiders that might arrive at your site using the wrongly formed URL, that it’s not there and they what they’re looking for is over here.

A 301 can be done in apache (or whatever http server you’re using) or it can be done in PHP (or whatever app-server language you’re using), but I think a .htacess file (or equivalent) is simplest.

Here’s what I’ve got to do this in my .htaccess file (yes, a file literally named that, and placed in my html home directory on my site):


RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.alistercameron.com$ [NC]
RewriteRule ^(.*)$ http://www.alistercameron.com/$1 [R=301,L]
#extra WordPress stuff here, coz that's the CMS I use...
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

So there you have it. Those two lines that contain my domain name are the two lines that do it for me… change to your domain name accordingly. These two lines basically look at any domain name that sends people to my site, and if that address is not exactly www.alistercameron.com, it 301 redirects them to that instead (and to the specific page or resource they requested).

But why am I doing this, vis-a-vis the title of this post? Well, I only want Google to find the content of my site in ONE place… at www.alistercameron.com. If I don’t do the 301 redirect, I might be indexed under www.alistercameron.com and alistercameron.com, and this might have bad repercussions for my pagerank, or indexing in general. BUT… here’s what it also does…

It makes sure that anyone visiting my site will bookmark and link to me using ONLY ONE URL. It doesn’t matter what they type in to get to my site, because as soon as they get here my webserver makes sure they see my site with the www, and that’s what they will subsequently bookmark, stick in del.icio.us, or whatever.

Are there more issues to consider here? I’d love to hear from you if you’ve experienced other issues with URLs and pagerank. I don’t have proof, personally, that Google can “split” your pagerank if you accept visits to both versions of your domain (with and without the www), but if you’ve got more on that… let us all know!

UPDATE: Daniel at Daily Blog Tips has posted recently on this very same question. I think his post makes a good complement to mine. Check it out!

seo, coding, subdomains, domain names, htaccess, apache, webserver, pagerank, google

6 Comments

Note: Commenter website links are not no-followed, in case
you were wondering... I believe in rewarding commenters!

  1. Posted 12 years, 5 months ago // Permalink

    You can also tell Google which URL to use through the “Preferred Domain” Google’s Webmaster Tool.

    If you have different PageRanks for both the WWW and non-WWW versions of your site, it’s generally best to pick the one with the highest PageRank from an SEO perspective.

    But by using a 301 redirect, you should be able to pass some of your “old” PageRank to your “new” preferred domain.

  2. Posted 12 years, 5 months ago // Permalink

    Thanks for picking the link, your post is also valuable.

    I heard that Google is taking action to correct that difference, but so far I would still use a 301 redirect to be sure!

  3. Posted 11 years, 10 months ago // Permalink

    I’m using a 301 redirect on my main blog feverishthoughts.com to include the www. The problem is that I have a few other blogs on this domain that I put in directories ie feverishthoughts.com/oddplanet. I want the directory blogs to have urls that do not contain the www because they have higher PR without the www in their urls, yet the main domain has a higher PR with the www in it’s url.

    So I’ve been using the nowww plugin on my directory blogs to keep the www out of the urls. I suspect this might actually be causing a bit of a problem on a few of the blogs because now they occasionally have the primary domain thewebfiles in their url as well if it’s accessed without a trailing slash. for example the Odd Planet blog sometimes converts it’s urls to feverishthoughts.thewebfiles.com/oddplanet

    I’d like to use an htaccess redirect to keep the www out my directory urls so I could avoid using the plugin. I’ve also read that the plugin might be using more cpu resource in my account and I’ve just had a terrible experience with web hosts and cpu resource over use so I want to trim down.

    Do you have any idea what htaccess redirect I might use to solve my problem?

  4. Alister Cameron
    Posted 11 years, 10 months ago // Permalink

    @tricia – you have some challenges there, but they’re all ideally suited to .htaccess, and yes… far less resource usage than a plugin.

    I am not smart enough (or don’t have the time right now!) to create the .htaccess entries you need, but I an say that you want to list the .htaccess rules for the subdirectories first. Then lastly the one which forces the www on the main domain. Apache reads down the .htaccess file, so it will parse the rules in order. You can then append the right “flag” to the subdirectory rules, so that if they are matched, Apache exits and doesn’t continue down the file.

    I hope that makes sense.

    Certainly, the one rule you need for the subdirectories will look the same for each one, so you just need to get it right once and then copy it for each sudirectory.

    I suggest asking for help in a forum somewhere. That’s usually where the “gurus” hang out!

  5. Posted 8 years, 9 months ago // Permalink

    And I may also add that the domain which has the www is better than the one which doesn’t have.

  6. Posted 8 years, 5 months ago // Permalink

    I did have the problem of not getting any pagerank. My website did not have the www. Today i put it back in the url. I’ll hope it makes a difference. Thanks for the post!

2 Trackbacks/Pingbacks

  1. […] already posted about how to use mod_rewrite to forcibly include or exclude a www in your domain (URL). You’ll notice on my site that if you remove the www, it gets stuck back […]

  2. […] same thinking is behind my first WordPress plugin, my WordPress mod_rewrite contributions, and my Habari logo idea… do you get […]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

  • My Posts in Your In-box!

    Enter your email address here for instant updates in your inbox, whenever I post something new.
    Your email address is in safe hands. Relax!
© Copyright 2006 Alister Cameron. All Rights Reserved Theme // Sitemap // RSS