Will a virtual host with 'ServerName example.com' catch sub-domains as well as the root domain?
I’m trying to run a new website from a sub-domain on my droplet, as well as a website at the root of the domain, e.g. example.com and new.example.com serving from different directories.
I’ve set up the directories, created virtual host files for each site, and enabled both sites.
Currently, every time I visit new.example.com I get 301 redirected to example.com. If I disable the example.com site using a2dissite, then new.example.com loads as expected.
The only reason I can think of this happening (I’ve investigated .htaccess files and ruled that out) is if the following line were catching the sub-domain because it doesn’t contain ‘www’:
Is this possible, or is the problem likely somewhere else and if so what could it be? I’ve exhausted my Google searches : /
I would like my main site to continue to serve without 'www’ if possible, whilst also running the new sub-domain on the same droplet.
Thanks for any help.