You can do this adding the following rewrite rules in your .htaccess file in the public_html directory or if you have addon domains in the .htaccess file in your addon domain directory:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.com$
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
Note: If you have multiple domains as addons, adding the above rule in the public_html .htaccess file will not effect in the addon domains. If you wish also force www redirection on addon domains you can add the same rules in the .htaccess file in each addon domain directory.
Keep in mind if you have other rewrite rules in your .htaccess file you may need modify the rule above to avoid conflicts.

You can find resources and usefull information about rewrite rules at http://forum.modrewrite.com/

Was this answer helpful? 1 Users Found This Useful (923 Votes)