Seems that this causes problems for people so I thought I could pop it up here as a useful resource. Use the following code and replace “domain.com” with your domain e.g. jonoellis.co.uk. Place all of the code in your .htaccess file and http://jonoellis.co.uk will redirect to http://www.jonoellis.co.uk.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]