I'd like to have all new domains include a rule, either in a VirtualHost or a .htaccess, that redirects requests to the root domain (example.com) to a subdomain (www.example.com). Currently, I'm doing this manually by putting a .htaccess file in everyone's home folders like this:
This is starting to get tedious to do for every account, since (in my case) almost all clients want the functionality.
Is there a way to configure WHM do do something like this for every new domain when it's created? I don't much care how it's achieved, but it's important that I still be able to disable it on a per-site basis if requested.
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
Is there a way to configure WHM do do something like this for every new domain when it's created? I don't much care how it's achieved, but it's important that I still be able to disable it on a per-site basis if requested.