I’m using this script very often, for some customers to redirect their website from domain.com to www.domain.com. So I will put it here for easy access.
RewriteEngine On RewriteCond %{HTTP_HOST} !^www. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Just create or insert above script into your .htaccess. When a visitor visits domain.com he will be forwarded to www.domain.com.
Piece of cake.
Leave a Reply