Default Subdomain Directory

typicalGtaTG

New member
Joined
Jun 26, 2021
Messages
3
Hi,
I just started using DirectAdmin for the first time and see that when I make a new subdomain, the subdomain root directory is set to be inside the root domain's directory under public_html. This concerns me a lot because not only are people able to access that subdomain using example.com/subdomain but also it's hard to manage site files that way and makes for a lot of clutter.
I wanted to ask if it's possible that I change the default path to be domains/subdomain/public_html without having to do that for every subdomain manually for every domain.
 

Richard G

Verified User
Joined
Jul 6, 2008
Messages
6,776
Location
Maastricht
It's not really hard at all to manage site files that way at all.
But I understand if you have multiple subdirectory's it can get confusing.

So yes it's possible to change the default location of subdomains. You have to create some custom changes though.

It can be done for the whole server, you have to change apache configs for that.

For 1 account it can be done like this:

There is also a GUI for it in Directadmin itself:
 

typicalGtaTG

New member
Joined
Jun 26, 2021
Messages
3
It's not really hard at all to manage site files that way at all.
But I understand if you have multiple subdirectory's it can get confusing.

So yes it's possible to change the default location of subdomains. You have to create some custom changes though.

It can be done for the whole server, you have to change apache configs for that.

For 1 account it can be done like this:

There is also a GUI for it in Directadmin itself:
I can make a backup of the current apache configs and change it, I'm not sure where I should look for it tho.
 

Richard G

Verified User
Joined
Jul 6, 2008
Messages
6,776
Location
Maastricht
Please don't quote complete messages.

It's mentioned in the second link:
Dashboard > Sub-Domains Setup > Document Root Override

Upon clicking Sub-Domains Setup, you should see an option to edit the document root (an edit icon that resembles a pencil), and upon clicking this option, will be taken to the Document Root Override path noted above.

I'm not sure if it can be done for the whole server by default, maybe somebody else knows.
 

typicalGtaTG

New member
Joined
Jun 26, 2021
Messages
3
I was able to achieve this by making a custom script and modifying the DOCROOT in the vhost template.
 

k1l0b1t

Verified User
Joined
May 10, 2020
Messages
371
Location
Belgium
This might be helpfull too. Moves the main domain into a difirent directory, instead of the subdomains.

 
Top