Redirection from http://domain.com to http://www.domain.com

If you want to redirect your domain from  http://domain.com  to http://www.domain.com,
then add the following lines in the .htaccess file for domain for which you want to set the redirection

=================================
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^/?$ “http\:\/\/www\.domain\.com\ ” [R=301,L]

=================================

That’s all this will do it.