Heres a simple little entry for a .htaccess file that automatically maps any non www. domains to the www.versions (may not work on sub domains) providing a neat way of controlling canonical domain issues with a little 301 magic.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$[L,R=301]
Enjoy!


How does this differ from the standard way? I see that you have different character in the code. What do they exactly do differently than the code I entered below?
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.com
RewriteRule (.*) [R=301,L]