Configuring multiple sub-domains
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.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.
-
The home directories for these two subdomains are /home/exampleuser/public_html/drive and /home/exampleuser/public_html/manage
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_html0 -
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? 0 -
What version of cPanel are you using? Do you have root access to this server? Or are you just a cPanel user? 0 -
Yes, I have full root access. I'm usually very technical, I am just not when it comes to cpanel configuration . 0 -
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? 0 -
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. 0 -
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, 0 -
It appears to have, yes . 0 -
Hello, Thank you for updating us @Justin Furnas ! I'm glad you were able to find a solution. 0
Please sign in to leave a comment.
Comments
9 comments