For consistency and SEO purposes, this will prevent Google from indexing both www and non-www domain version of your site and avoid duplicated content issue. I prefer to re-direct from non-www to www, so here is my code that I’m using on clipsify.com. Just copy and past into your .htaccess file and it will work right away.

# Redirect from non-www to www
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# End Redirect from non-www to www