Suppressing ServerAlias or specify new DocumentRoot


Dec 5, 2011
cPanel Access Level
Root Administrator
I have setup an account for one of my clients with their domain name, however their hostname of gets added as a ServerAlias to Apache pointing to their own accounts directory space.

I need to either suppress the creation of the www hostname so I can add that as a ServerAlias to a VirtualHost container I need to create for my own software


be able to change where the DocumentRoot points too in the VirtualHost container for that account.

This comes back to my previous query in being able to create my own custom VirtualHost containers, but those custom VirtualHost containers are NOT required for the majority of domain names hosted on our cPanel enabled web server.

Any solutions?

Something else that I have discovered which is very very annoying, when adding in an addon domain it sets up a ServerName of


Main Domain is
Addon Domain is

ServerName becomes
with a

This is bloody awful, how can I stop this from happening?
Last edited:


Quality Assurance Analyst
Staff member
Oct 2, 2010
somewhere over the rainbow
cPanel Access Level
Root Administrator
To either remove the ServerAlias or change the DocumentRoot directive after account creation, both can be done in /var/cpanel/userdata/username/ location. The settings in /var/cpanel/userdata build httpd.conf file.

After making any edits to /var/cpanel/userdata/username/ location, you then would need to rebuild Apache and restart Apache:

/etc/init.d/httpd restart
Since you mention only doing this for some accounts, you could create a script that would revise /var/cpanel/userdata/username/ after account creation, which you could run on accounts you want to revise after you've created the account.

Of note, I also want to mention that there is another template file that was never discussed in the last thread you had opened discussing the VirtualHost containers. That template is /usr/local/cpanel/etc/httptemplates/apache2_2/default which controls the VirtualHost template being built for newly created accounts. This is discussed at Changes Contained within a VirtualHost Directive location. You likely already know this, but in case you did not.

As for the addon domain question where subdomains are automatically created, I would not advise trying to stop that creation, since they are currently tied into how addon domains function under cPanel where the addon domain is the ServerAlias of the subdomain. If you try to remove or prevent the subdomain creation, you can possibly break the addon working. Instead, you may wish to post support onto the feature request where true multi-domain existence has been lodged --> (specifically post where this is detailed in that thread).