What issue or error are you experiencing?
I’m transitioning from MAMP (MacOS) where I can do this straightforwardly, but it doesn’t work on Local (which is otherwise far superior).
Because reasons, I need a local environment that mirrors parking domains on a web host, so that I have several domains or sub-domains pointing to the same local folder, e.g.
mydomain.local
subsite.mydomain.local
alt.mydomain.local
all point to the same Local Sites folder, and when you visit those urls they display the same site, and the urls do not change.
Based on how I do this in MAMP, I have edited the etc/hosts file so that each of those domains map to 127.0.0.1
For the site I have created in Local I have switched to using Apache (same set up as MAMP) and I have edited the file conf/apache/apache2.conf.hbs and added the following:
<VirtualHost *:80>
DocumentRoot "/Users/xxx/Local Sites/mydomains/app/public"
ServerName mydomain.local
ServerAlias subsite.mydomain.local alt.mydomain.local
</VirtualHost>
It nearly works, visiting any of the URLs does show the site content, but the url updates to the main url, the subdomains are redirecting to the main domain.
What else would be needed for this to work with Local?
I’m not averse to changing to use nginx rather than Apache if that helps.
System Details
-
Local Version:
Version 9.0.5+6706 -
Operating System (OS) and OS version:
MacOS Sonoma Version 14.5 (23F79)