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!
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.
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.
we probably know an answer but you seem to expect us to be able to guess your real question
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.