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!

Not seeing how to change docroot in sub-domain site

Discussion in 'General Discussion' started by cpandave, May 1, 2018.

  1. cpandave

    cpandave Registered

    Joined:
    May 1, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Utah
    cPanel Access Level:
    Root Administrator
    I've been given access to the cPanel of a sub-domain like dave.domain.com, and the default docroot appears to be public_html/dave.domain.com, but that makes a nonsensical URL like http://dave.domain.com/dave.domain.com/, but even after reading the cPanel docs I'm not seeing how to change this.

    Document Root Changes « eHost Support Portal

    On step 3 it says "In the Modify a Domain section at the bottom of the page, click the icon next to the current document root for the domain you wish to modify.", but in "Modify Addon Domain" there's no domains there, just "No addon domains are configured."; there's a "Create an Addon Domain", but of course I don't want to create an addon domain...

    If I go into the Subdomains section, it's the same thing, no domain to modify... creating an subdomain just appends another sub-domain like sub.dave.domain.com, which says "This site can’t be reached" when gone to (Firefox equivalent says "We’re having trouble finding that site"), and in the Redirection column has a nonsense URL like "http://sub.dave.domain.com/\.git" (I don't know why it put "\.git" there)... clicking it goes to like /.git (reverses the backslash) and also says can't be reached. If I click Manage Redirection, anything I change /\.git to (which is the only thing in the field) doesn't appear to actually change it and also says can't be reached. I can disable redirection but I still says can't be reached.

    I'm not making sense of this, nor seeing anywhere else to change the sub-domain's docroot (not the sub-sub-domain), and I've already tried changing it in command-line but it appears I need to have access through the main site to get this to work. The admin isn't replying and maybe doesn't know themselves how to do it...

    Anyone know what to do about this?
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,142
    Likes Received:
    1,932
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @cpandave,

    The default document root for the primary domain name associated with a cPanel account is as follows:

    /home/$username/public_html/

    The information you provided suggests you've uploaded your website files to a subdirectory within public_html, and you have custom Mod_Rewrite rules in the .htaccess file within the public_html directory that are redirecting requests to the wrong location. If this is a WordPress website, steps to solve this issue are available at:

    Moving WordPress « WordPress Codex

    Otherwise, you can use the following steps as a workaround to modify the default document root for the domain name utilized at account creation time:

    1. Update the "documentroot" value to the new path in the following files:

    /var/cpanel/userdata/username/domain.tld
    /var/cpanel/userdata/username/domain.tld_SSL

    2. Remove the existing cache files:

    Code:
    rm /var/cpanel/userdata/username/domain.tld.cache
    rm /var/cpanel/userdata/username/domain.tld_SSL.cache
    3. Rebuild the cache files and the Apache configuration file:

    Code:
    /scripts/updateuserdatacache
    /scripts/rebuildhttpdconf
    4. Restart Apache:

    Code:
    /scripts/restartsrv_httpd
    Additionally, I encourage you to vote and add a comment to the following feature request if you'd like an option to modify the default document root added to the product:

    Allow users to change the DocumentRoot

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    ItsMattSon likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice