How to change folder of subservers

SYSTEM INFORMATION
OS type and version almalinux 9
Virtualmin version 810

Hello

I have a main domain as a virtual server in /home/domain/public_html

And when I create a sub-server (subdomain), it places it by default here:

/home/domains/subdomain.domain.com/public_html

But I need to be able to choose the location within the main domain’s public_html directory, something like /home/domain/public_html/subdomain (or any other location, but I need to choose it within this directory).

I’ve tried different strategies to modify this, but I haven’t been able to.

Could someone give me some specific guidance? Thanks!

1 Like

should this really start with an explanation of why you want to change it?

it probably can be done - most things are possible. when there is a good reason to do it - but not just because it can be done

1 Like

Do you know how to do it? Can you tell me how? Thanks

Depends on exactly what you want to do, if this a one off, just edit the apache (assuming you’re using apache, you haven’t told us) to point to the directory you want, and move the files there, however there could be loads of gotcha’s that you will have to test and fix as required. I will reiterate what @Stegan said why do you need to do it ? Is it ease of finding the files to edit/upload ? If so just create a symlink in the main user directory that points to the sub domain. If not perhaps you dont need a sub domai as you could just put the content in a directory below the main domains public_html directory. It would be nice to know why you need to do this

Just out of curiosity, why doesn’t Virtualmin have a simple way to choose the folder a subdomain points to, like DirectAdmin or cPanel? Looking for help on the forum, I see it’s a common question, and the solutions are unnecessarily complex (complex not because of the difficulty, but because they increase workload that could be simplified with a folder selection).

If the user wants two or more domains to share the same public_html folder, why point the subdomains so randomly? Is there a technical justification for this? Thanks.

1 Like

because Virtualmin is not the same and certainly does not need to be.

just learn how to use it

as I said the question is why? not how - how is almost certainly possible if we can understand why?

and an excuse “because a.n.other panel does it” just sounds like a lazy AI generated question.

it is not random.

it may appear that way to some - usually not understanding sub domains. or why they need separation.

The correct thing to do when one does not know an answer is to remain silent and take advantage of the reading of someone who eventually adds positively to a possible solution.
unproductive and egocentric interpellations for other contexts. thanks.

As you never answered any of my questions, I give up

From what you have said, and we will not guess as to what is not said, this sounds more like you want an alias.

1 Like

but how can we answer such a vague question?

we probably know an answer but you seem to expect us to be able to guess your real question :disappointed_face:

the real objective should be to learn how to do things the Virtualmin way, rather than come here to try to convert things to the way it is done on other panels.

everyone here tries very hard to help and to be positive - but that does require a co-operative approach a two-way street to arrive at some constructive end-point.

You almost certainly want an Alias, and perhaps a rewrite rule to make it serve from a sub-directory when the HOST header is the Alias.

There are security implications to serving stuff this way (cookies, the subdirectory path is accessible on the parent domain on a different path and possibly without restrictions you think are present, etc.). It’s hard to reason about how it will behave.

1 Like

Thanks Joe, I solved it that way.

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.