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 the way Primary Domain Document Root works

Discussion in 'General Discussion' started by eric.langley, Jan 6, 2014.

  1. eric.langley

    eric.langley Member

    Joined:
    Mar 2, 2013
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello All,

    Testing cPanel, so far so good.

    I have a question about setting up the primary domain and sub domain document roots.

    I created an account and uploaded a site to it. Worked fine.
    Then I added an addon domain and created a subdomain for it.

    However cPanel put Document Root is inside my primary domains root folder. Not good. I know you can adjust Server Tweaks to allow putting sub domains above public_html but that is not what I want to do. I would like to have all of the domains have their own folder under public_html. Like this:

    Primary Domain in /home/account/public_html/primarydomain
    and all of the other domains as well
    /home/account/public_html/anotherdomain
    /home/account/public_html/site.anotherdomain

    It's easy to add new sub domains like this but the primary domain is not created this way.

    How can this be addressed?

    TYIA,

    ~eric
     
  2. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    You must edit the file:
    /var/cpanel/userdata/USERNAME/DOMAIN.COM

    and change the line:

    documentroot: /home/USERNAME/public_html

    to

    documentroot: /home/USERNAME/public_html/DOMAIN.COM

    and then run:

    /scripts/rebuildhttpdconf
    service httpd restart
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You will need to manually modify the document root of the primary domain name associated with the cPanel account using the instructions in the previous post. The path to the file to edit is:

    Code:
    /var/cpanel/userdata/$username/$domain.com
    Thank you.
     
Loading...

Share This Page