Change root folder for main site (public_html)

mebony

Registered
Feb 10, 2013
3
0
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!
 
Last edited:

quietFinn

Well-Known Member
Feb 4, 2006
2,042
553
493
Finland
cPanel Access Level
Root Administrator
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 ???
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.
 

mebony

Registered
Feb 10, 2013
3
0
1
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.
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.
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
 

phicts

Active Member
Feb 8, 2013
36
0
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
 

phicts

Active Member
Feb 8, 2013
36
0
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).
 

mebony

Registered
Feb 10, 2013
3
0
1
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).
So how do I do what I need to do? Is it possible to do that from WHM?
 

phicts

Active Member
Feb 8, 2013
36
0
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 - - -

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
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.
 

quietFinn

Well-Known Member
Feb 4, 2006
2,042
553
493
Finland
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.
Yes that does work, I am doing it all the time.


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).
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.