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 folder for main site (public_html)

Discussion in 'General Discussion' started by mebony, Feb 10, 2013.

  1. mebony

    mebony Registered

    Joined:
    Feb 10, 2013
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I need exactly what this guy, User 2011, needed a while ago: http://forums.cpanel.net/f5/main-site-folder-public_html-214282.html

    Are the steps exactly the same? I'm asking because this guide is from 2011.

    And my main question is:

    If I do these changes and change the root folder to become home/blah/public_html/mysite.com INSTEAD of current root folder home/blah/public_html/ when I'll create subdomains from cPanel, where will they be created? In home/blah/public_html/mysite.com/subdomain1.mysite.com ??? or in home/blah/public_html/subdomain1.mysite.com ???

    Shortly said I just want my main site's root folder to be this (example of what I want):
    home/blah/public_html/mysite.com
    and my subdomains to look like this:
    home/blah/public_html/subdomain1.mysite.com
    home/blah/public_html/subdomain2.mysite.com
    home/blah/public_html/subdomain3.mysite.com

    I DO NOT want my subdomains to go inside the root folder (example of what I don't want):
    home/blah/public_html/mysite.com/subdomain1.mysite.com
    home/blah/public_html/mysite.com/subdomain2.mysite.com

    It's extremely important for security reasons and for ease of file management that sites (both domains and subdomains) are stored in different folders!
     
    #1 mebony, Feb 10, 2013
    Last edited: Feb 10, 2013
  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
    They will be created wherever you want inside your home directory (/home/blah/), cPanel only suggests a folder, but you are free to change it.
     
  3. mebony

    mebony Registered

    Joined:
    Feb 10, 2013
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I see, well let's suppose I want to move my main site here: home/blah/public_html/mysite.com

    When I will want to add subdomains from cPanel, will it automatically create them in public_html?
    EXAMPLE:
    home/blah/public_html/subdomain1.mysite.com
    home/blah/public_html/subdomain2.mysite.com
    home/blah/public_html/subdomain3.mysite.com

    I don't want them to be look like this when I create a subdomain from cPanel and then have to manually change their destination each time I create a subdomain:
    home/blah/public_html/mysite.com/subdomain1.mysite.com
    home/blah/public_html/mysite.com/subdomain2.mysite.com

    What do I need to do to achieve this?

    Thanks
     
  4. phicts

    phicts Active Member

    Joined:
    Feb 8, 2013
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    When you create an account in WHM, you set the domain name (mysite.com), the username, password, package and other settings.

    Then WHM will automatically create the directory or home folder for that account in /home
    (/home/username/directories_and_files_of_the_user_will_be_here)
    The domain/website will be under /home/username/public_html/

    The subdomain is created from the Subdomain link in the Cpanel. But the contents of that subdomain is still under
    /home/username/public_html/subdomain_folder_is_here_which_will_be_linked_from_the_subdomain_setting
     
  5. phicts

    phicts Active Member

    Joined:
    Feb 8, 2013
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    I have read that you can put your subdomain folder/files directly under /home/username, in the same level as /public_html, like
    /home/username/your_subdomain_folder_here
    but I haven't tried it personally.
    What i know is that anything above /public_html or /www shouldn't be accessed/displayed by "http/https" except when you're hacked or its by ftp (file transfer protocol).
     
  6. mebony

    mebony Registered

    Joined:
    Feb 10, 2013
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    So how do I do what I need to do? Is it possible to do that from WHM?
     
  7. phicts

    phicts Active Member

    Joined:
    Feb 8, 2013
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Just point your subdomain to the particular directory or folder under the /public_html and name it something else if you don't want it accessed directly on it's name.

    For example, subdomain "blog.yourdomain.tld" points to /public_html/i_dont_want_others_to_see_this

    "Aliasing" like that is not a security step, though.

    - - - Updated - - -

    You just put the folder or directory under your /public_html and point your subdomain to it and Cpanel will automatically link it for you. you don't have to manually change the location. You should also not change the location once you set the subdomain to point to it.
     
  8. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    Yes that does work, I am doing it all the time.


    There is no difference between /home/USERNAME/public_html and /home/USERNAME/folder_for_a_subdomain, the latter is not above public_html, it's in the same level.
     
Loading...

Share This Page