A problem I see on many web sites is that they don’t have a proper re-direct in place for the non-www version of their web site.
In other words, you can access the site as either:
http://www.thesite.com or
http://thesite.com
You might think this is no big deal, however it could be hurting your search engine ranking, as Google may be indexing your site under both variations – so I highly recommend that you check it and get it fixed ASAP.
How do you check for this issue?
Simple – type the full address of your site in the browser URL area, e.g.
http://www.yoursite.com
Then – type the address without the “www.”, e.g.
http://yoursite.com
Check the browser URL – did it stay “http://yoursite.com” (bad) or did it change to “http://www.yoursite.com” (good!)
If it changed, then you already have the redirect in place – nothing for you to worry about.
If not, then you need to fix your site to redirect from the non-www version to the www version. (You can actually redirect the other way if you prefer, however my recommendation at present is to favor www – that still seems to be what most folks expect).
My instructions here are for Apache and involve editing the .htaccess file which is typically found at the top-level directory of your web site.
The sample code snippet I use in the video is:
# Important - replace <your-domain> with your actual domain e.g. myDomain.com
# Do NOT include the "www" in your domain - the code below takes care of it
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Options +FollowSymlinks
### Fix non-www to www (canonicalization) redirect ###
RewriteCond %{HTTP_HOST} ^<your-domain> [NC]
RewriteRule ^(.*) http://www.<your-domain>/$1 [R=301,L]
### End fix for non-www to www canonicalization redirect ###
</IfModule>
Here’s a brief video demonstrating the canonicalization issue on a sample website and showing step-by-step how you can apply the fix
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
{ 12 comments… read them below or add one }
Steve, that was a fantastic video you put together, addressed what i expect to be a common problem, well done. Life would be a great deal easier if every problem we came across had a SteveO how to video addressing it. Thanks again, it was a huge help to me.
I’ve got a few of these topics that come up all the time – I’ll try to make vids for all of ‘em – one bit at a time…
Hey Steve,
Thanks for the very informative and easy to understand Vid. I was just wondering how to do this for a client today and stumbled upon this, thanks again.
Glad to help!
Steve, thank you for that valuable post. I’ve been struggling with these issues and here you explain everything in a clear and simple way:))
Simply great stuff!
Thanks Justyna
Great tip, Steve as i’m just getting into the power of linking and wouldn’t want my results to be diluted. Some of my sites are http://mydomain.com and some have the www so now I can make them all go to a www and not worry. You make editing so easy … especially important for technophobes like me
“Make changes boldly… and always have a backup” I say! ;^)
Cracking little vid Steve – I’d lost the code and was just looking for it again and knew you’d have the goods! Nice to see an explanation of the code too!
Thanks David – glad to be able to help!
HI steve if you are using wordpress, does it already take care of this canonicalization issue without making any changes to the htaccess file. i mean going to setting, then general and adding a www infront of the WordPress address (URL) and Blog address (URL).
absolutely Adam – Wordpress already does this. Just one more reason you I recommend it for clients. Heck, even Matt Cutts raves about Wordpress SEO capabilities: http://searchengineland.com/googles-matt-cutts-video-presentation-on-seo-24234
However, a lot of people have static HTML or Flash (shock-horror) or other platforms (like TextPattern) and they have this issue. It’s one of the first things I check (and fix) for new clients.
Steve