Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Change root directory for the main domain?

Discussion in 'General Discussion' started by lordfkiller, Feb 8, 2017.

  1. lordfkiller

    lordfkiller Registered

    Joined:
    Feb 8, 2017
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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?
     
  2. NOC_Serverpoint

    NOC_Serverpoint Well-Known Member

    Joined:
    Jul 3, 2016
    Messages:
    102
    Likes Received:
    6
    Trophy Points:
    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,
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page