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!

SOLVED Configuring multiple sub-domains

Discussion in 'General Discussion' started by Justin Furnas, Apr 19, 2018.

  1. Justin Furnas

    Justin Furnas Member

    Joined:
    Aug 1, 2017
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Michigan
    cPanel Access Level:
    DataCenter Provider
    Sorry if this is in the wrong place, I couldn't find a configuration specific section of the forums.

    I have a cpanel server installed. On it, I have a domain. We'll call it example.com

    There is also a virtualhost on it for a user, we'll call exampleuser.

    The main served folder for example.com (and www.example.com) is /home/exampleuser/public_html

    inside whm, 2 subdomains were created for this domain.

    drive.example.com

    and manage.example.com

    The home directories for these two subdomains are /home/exampleuser/public_html/drive and /home/exampleuser/public_html/manage

    The problem I am running into, is if I go to manage.example.com, it appears to be conflicting with the root of the example.com domain, and that .htaccess appears to be rewriting the domain to www.manage.example.com

    Is there a way I can configure cpanel (for this account/domain only) to use sub-directories for all the sites? (The main site inside public_html/main for example), and the sub-domains still inside of their sites? I tried changing the values in /var/cpanel/userdata/example/example.com but after rebuilding and restarting the site was no longer accessible. (Gave a 403 error and a couple other things). I need to have the .htaccess in place on the main site, so I can't just remove it.
     
  2. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,675
    Likes Received:
    84
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    These are called DocumentRoots. That will help with terminology better later on.

    The best solution is to create your subdomains with DocumentRoots outside of the public_html folder, i.e.

    drive.example.com with a DocumentRoot of /home/exampleuser/drive.example.com

    manage.example.com with a DocumentRoot of /home/exampleuser/manage.example.com

    I actually believe this is the default behavior in cPanel when you create a subdomain now.

    This way your subdomains are not interfered with the .htaccess file in /home/exampleuser/public_html
     
  3. Justin Furnas

    Justin Furnas Member

    Joined:
    Aug 1, 2017
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Michigan
    cPanel Access Level:
    DataCenter Provider
    I have the most recent version of cPanel, and when I create subdirectories it doesn't do this. The root it starts at is inside of the 'public_html' directory, and I can't go back to the previous directory.

    Is there a specific thing I need to configure to fix it so that it works that way, and can I safely reconfigure my current subdomains to use that new structure without breaking them?
     
  4. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,675
    Likes Received:
    84
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    What version of cPanel are you using?

    Do you have root access to this server? Or are you just a cPanel user?
     
  5. Justin Furnas

    Justin Furnas Member

    Joined:
    Aug 1, 2017
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Michigan
    cPanel Access Level:
    DataCenter Provider
    Yes, I have full root access.

    I'm usually very technical, I am just not when it comes to cpanel configuration .
     
  6. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,675
    Likes Received:
    84
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    Log into your WHM, click on Tweak Settings, look for the Domains section. Is the option Restrict document roots to public_html on or off?
     
    Justin Furnas likes this.
  7. Justin Furnas

    Justin Furnas Member

    Joined:
    Aug 1, 2017
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Michigan
    cPanel Access Level:
    DataCenter Provider
    Right now, it's set to 'On'.

    When changing it, I am able to edit my subdomains to point to /whatever.example.com, except now when doing that I get a 403 error on all of the sites. (After moving the files to the new directory).

    Nevermind, this appears to have fixed it.
     
  8. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,855
    Likes Received:
    135
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @Justin Furnas

    To confirm disabling Restrict document roots to public_html as suggested by @sparek-3 resolved your issue once you moved the sites?


    Thank you,
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. Justin Furnas

    Justin Furnas Member

    Joined:
    Aug 1, 2017
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Michigan
    cPanel Access Level:
    DataCenter Provider
    It appears to have, yes .
     
  10. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,855
    Likes Received:
    135
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hello,


    Thank you for updating us @Justin Furnas ! I'm glad you were able to find a solution.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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