Redirecting non-www to www
One of the most common problems I see with even some big brand websites is the lack of a null host file on the server - you can type www.<bigbrand>.com in but if you just try <bigbrand>.com it doesn’t work - there is no real excuse for this.
But the truth is that even if you do have the null host file pointing to the right directory you should still consider redirecting people from the non-www site to your www - type prestonwily.com in your address bar and you will see it redirect to www.prestonwily.com. To see an example of the opposite type in www.sewelldirect.com and you will be redirected to sewelldirect.com.
So why is this important? Because Google (and other engines) frequently can’t distinguish between your non-www and www versions of your site. This in and of itself wouldn’t be a big problem, but all those inbound links that you spend so much time and effort building can effectively be split between your “two” sites.
Here is the easiest way to implement the redirect (assuming you are using Apache and have mod rewrite enabled - if you don’t know what this means just try this technique and if it doesn’t work you probably don’t have mod rewrite enabled - contact your web host):
1) Check your ftp folder for your website for a file called .htaccess. If you already have one just add the code from step 3 to it.
2) Create a new file (locally) called htaccess.txt. (Note: if you are using a windows machine you may or may not be able to see and edit .htaccess files. This is why I recommend calling it htaccess.txt until you upload it to your server).
3) Open htaccess.txt and add the following code (replacing domain with your domain name):
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]4) Upload htaccess.txt to your server (in the directory holding your website files).
5) Rename htaccess.txt to .htaccess.
That’s all you have to do - pretty easy and you’ll thank me down the road.
4 Comments »
RSS feed for comments on this post.
| TrackBack URI
You can also bookmark
this on del.icio.us or check the cosmos
Preston, this canonical url problem used to be a problem with Google but as of BigDaddy a year ago they combined the two together completely. In fact, even before that they were pretty consistently correcting problems. I still would suggest that this is a good idea just for url consistency sake, but it isn’t very important for SEO anymore.
Comment by Trent — March 22, 2007 @ 7:26 pm
Thanks for the comment. I don’t believe, however, that BigDaddy has completely solved this problem. For instance go to culinarycrafts.com and www.culinarycrafts.com - the first has a PageRank 2 and the www has a PageRank 4.
Obviously all of the canonical issues were not addressed - I always advise people to 301 to their preferred address.
Comment by admin — March 22, 2007 @ 11:01 pm
More proof of remaining canonical issues: do a google search for the secret dvd - the first two results are the same site but not indented - the first is the www and the second is without.
Comment by admin — March 23, 2007 @ 5:14 pm
implemented. thanks for the easy to follow steps.
Comment by cameron gibbs — April 30, 2007 @ 7:12 pm