Using A Different DocumentRoot Setting

tonex

New Member
The default DocumentRoot in Apache config is "/home/username/public_html". I need my config to be something like "/home/username/mycustomdir/public".

I can change this easy from the httpd.conf but there's a big warning there:
"DO NOT EDIT. AUTOMATICALLY GENERATED. IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES."

Is there a way to edit the httpd.conf from Cpanel of WHM (I have explored but can't find any.)? If not, how do I create the include file and where do I insert the Include statement inside the httpd.conf file (before or after all those config statements there)?

I have read how to include a config file. I just need to make sure I am understanding it correctly.

Thanks.
 

KH-Jonathan

Director of Managed Services
Staff member
Locate and edit the following file (replacing your user & domain info):

/var/cpanel/userdata/USERNAME/DOMAIN.COM

1. Once you have opened the file, look for the following line:

documentroot: /home/USERNAME/public_html

2. Modify the location according to your needs. Save it and exit.

3. Rebuild the Apache conf and restart Apache:

/scripts/rebuildhttpdconf
service httpd restart

The change will be immediate. Simply clear your browser cache and force refresh the page!

Hope this helps :)
 
Top