Lighty_46

Registered
Apr 8, 2014
1
0
1
cPanel Access Level
Website Owner
Hi,

I've just added an Addon domain through cPanel, and was wondering how I would go about adjusting the current folder layout from the following:

public_html (currently the primarydomain.com web root)
> secondarydomain.com

to this:

public_html
> primarydomain.com
> secondarydomain.com

I've had a look through the cPanel, but cant find anything that would allow me to do this, but I might just be missing something. I can obviously create the folders and add the files through FTP, but I don't know how to change the primary domain's web root.

Any help is appreciated,
Thanks! :)
 

cPanelMichael

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

You can modify the document root for a domain name by editing the "documentroot" entry in the appropriate cPanel user data file:

Code:
/var/cpanel/userdata/$username/$domain.com
Then, rebuild the Apache configuration file via:

Code:
/scripts/rebuildhttpdconf
Thank you.
 

Breuddwydion

Registered
Sep 4, 2015
1
0
1
Iowa
cPanel Access Level
Root Administrator
Is this still the best way to modify the domain roots, or is there a cPanel / WHM -only way to do this? Now that cPanel has evolved for a couple of years, I'd prefer not to do something that might "confuse" the GUI going forward if this is available via the GUI.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
Is this still the best way to modify the domain roots, or is there a cPanel / WHM -only way to do this? Now that cPanel has evolved for a couple of years, I'd prefer not to do something that might "confuse" the GUI going forward if this is available via the GUI.
Hello,

You should follow the instructions on the document below when making this change with EasyApache 4:

Modify Apache Virtual Hosts with Include Files - EasyApache 4 - cPanel Documentation

Setup a custom include file for the domain name and define a custom DocumentRoot value.

Let us know if you have any questions.

Thank you.