jimlongo

Well-Known Member
Mar 20, 2008
253
21
68
Hi, I have an account on which I have a lot of addons and subdomains, and for organization I want to have the main domain in a subfolder of public_html.

I can do this by editing httpd.conf and changing the line in that section from this
Code:
<VirtualHost xx.xx.137.162:80>
    ServerName xyz.com
    ServerAlias www.xyz.com
    DocumentRoot /home/xyz/public_html/
. . .

to this
Code:
<VirtualHost xx.xx.137.162:80>
    ServerName xyz.com
    ServerAlias www.xyz.com
    DocumentRoot /home/xyz/public_html/xyz

But I understand I should do this in the WHM Apache includes editor instead of directly in the httpd.conf file.

My question is which include file, and what exactly do I put in there. Do I add the whole Virtual Host section with changes?

Thanks,
jim
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
Hello :)

You can change the document root path in the cPanel user data file for the domain name. This is located at:

Code:
/var/cpanel/userdata/$username/$domain.com
Look for "documentroot:" and modify it to the new path. Then, save the file and rebuild the Apache configuration file:

Code:
# /scripts/rebuildhttpdconf
Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
Thank you.

Do I need to change the scriptalias path: as well.
You only need to change that if the cgi-bin will be utilized in a different location than what's configured by default.

Thank you.