How can i force my domain to www using htaccess?

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} ^$
RewriteRule ^(.*)$$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

  • 1 Users Found This Useful
Was this answer helpful?
Related Articles
Copyright © 2020 PlusPlusHosting.Net. All Rights Reserved. is an authorized reseller of goods and services provided by PlusPlusHosting.Net.