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!

Subdomain outside of public_html

Discussion in 'General Discussion' started by kimass, Jun 18, 2019.

  1. kimass

    kimass Registered

    Joined:
    Jun 18, 2019
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Serbia
    cPanel Access Level:
    Website Owner
    Hi,

    I have shared hosting with one main website (wordpress) and a couple of subdomains. Main site is in the root (public_html).

    When I install subdomain, cpanel put the instalation here: mysite.com/mysubdomain. I would like to have complete subdomain instalation files out of public_html, but keep the url mysite.com/mysubdomain.

    Thanks for your help.

    Best regards
     
  2. GOT

    GOT Get Proactive! PartnerNOC

    Joined:
    Apr 8, 2003
    Messages:
    1,484
    Likes Received:
    187
    Trophy Points:
    193
    Location:
    Chesapeake, VA
    cPanel Access Level:
    DataCenter Provider
    I do not think that would be possible. You might be able to get away with manually creating that folder in your public_html and then use a url rewrite in the htaccess to rewrite it back to the subdomain.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. DennisMidjord

    DennisMidjord Well-Known Member

    Joined:
    Sep 27, 2016
    Messages:
    212
    Likes Received:
    24
    Trophy Points:
    18
    Location:
    Denmark
    cPanel Access Level:
    Root Administrator
    It is possible, but only if your host allows for it. They'd need to go to WHM > Tweak Settings > Domains > Restrict document roots to public_html and disable it.

    When the setting is disabled, you can have a document root anywhere in your homedir.
     
    cPanelLauren and verdon like this.
  4. GOT

    GOT Get Proactive! PartnerNOC

    Joined:
    Apr 8, 2003
    Messages:
    1,484
    Likes Received:
    187
    Trophy Points:
    193
    Location:
    Chesapeake, VA
    cPanel Access Level:
    DataCenter Provider
    Agree with @DennisMidjord however, you still won't also be able to access the subdomain as mysite.com/mysubdomain without some kind of rewrite.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    DennisMidjord likes this.
  5. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,459
    Likes Received:
    503
    Trophy Points:
    263
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    The only reason mysite.com/mysubdomain works is because that folder is within the documentroot for mysite.com. As noted by @GOT you'd need a rewrite in place to retain this URL if the mysubdomain folder is outside of public_html
     
    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