SOLVED Configuring multiple sub-domains

Justin Furnas

Member
Aug 1, 2017
10
0
1
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.
 

sparek-3

Well-Known Member
Aug 10, 2002
1,929
178
343
cPanel Access Level
Root Administrator
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_html
 

Justin Furnas

Member
Aug 1, 2017
10
0
1
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?
 

Justin Furnas

Member
Aug 1, 2017
10
0
1
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.