How to set subdomains in the same folder?

SYSTEM INFORMATION
OS type and version Ubuntu Linux 20.04.3
Webmin version 1.990
Virtualmin version 6.17-3
Apache version 2.4.41

Hi!
I’m trying to set a webapp with the subdomains. The domain is in the folder /home/dropshipping and it shows a landing page. All the subdomains are Prestashop multishops and I need ubicate all in the same folder like /home/dropshipping/shop. I try to modify manually the configuration file to change the document root but it download the index page, in the parent domain the php files works correctly.
I tryed to put the files in the /home/dropshipping/domains/sub1/public_html and this subdomain works properly, but if i’m pointing other subdomain to this folder the web shows the code.
Where I can find the documentation to do it??

Thanks in advance

I response my own question,
I remake the virtual servers, this time in a subdomain folder (sb1), i put the files in this folder, and in the virtualserver config files i changed the document root and the cgi folder pointing to the sb1 and it works

@Kaizo,

There are two ways to accomplish what I believe you are after.

Either use a “.htaccess” file and point different domains as “aliases” to the primary domain. In this model, the “.htaccess” file would interpret which domain was accessed and display the appropriate shop.

The second model would be to visit:

Server Configuration > Website Options

From this page set Website Matches All Sub-Domains to Yes

Now, all sub-domains such as “shop1.domain.com”, “shop2.domain.com” would point to the primary site “domain.com” and then you’d use a “.htaccess” file as noted above.

2 Likes

Thanks for your response, the second model works perfectly!

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