Redirect non www url to www using htaccess

Add the following to your htaccess file immediately after RewriteEngine on
RewriteCond %{HTTP_HOST} ^mywebsite.com$
RewriteRule ^(.*) http://www.mywebsite.com/$1 [R=301]
Replace mywebsite with the domain name of your website