Change root directory for the main domain?

lordfkiller

Registered
Feb 8, 2017
1
0
1
Australia
cPanel Access Level
Website Owner
Here's my situation:
  • I need a URL shortener
  • I like Polr best
  • Polr requires changing root directory to wherever_it_is_copied/public
  • I can't find a way to change the root directory for the main domain
  • My hosting plan doesn't allow add-on domains
So, do I have to forget about Polr or is there still light at the end of the tunnel?
 

NOC_Serverpoint

Well-Known Member
Jul 3, 2016
103
7
18
cPanel Access Level
Website Owner
Hello,

For changing the main/primary domain, you will need to have root SSH access and be able to 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!

Regards,
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello,

You will need to reach out to your hosting provider to have them manually update the document root for the primary domain name, using the instructions in the previous post. It's not possible to make this change without root access to the system.

Thank you.
 

Ben Taylor

Member
Jun 27, 2019
18
2
3
Swaziland
cPanel Access Level
Root Administrator
Hello,

For changing the main/primary domain, you will need to have root SSH access and be able to 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!

Regards,
I have followed this but still it resolves to old website. I even restarted the entire server and in cPanel > Domain it says the new document root has been applied.

There must be another place this needs to be edited?