Manually edit vhost file on WHM-Cpanel server

If you need to manually edit the vhost file on a server that is running WHM and cPanel then you need to edit the include files which are used to build the vhost file. The include files for each account are held in the following location:

/var/cpanel/userdata/*accountname*

The main file would be

/var/cpanel/userdata/*accountname*/yourdomain.com

Parked domains and subdomains are held in the "main" file in the same folder. For an account, "yourdomain" and the URL yourdomain,com you would edit:

/var/cpanel/userdata/yourdomain/yourdomain.com

After editing the file you need to run the following three commands to rebuild the vhost file.

/usr/local/cpanel/bin/apache_conf_distiller --update
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart