Question by : Apache virtual host config?
I need to be able to manipulate the host header to map to directories like this:
Website A:
*.subdomainA.(any valid tld or subdomain-tld combination, or perhaps a list of domain names?)
a.subdomainA.example.com
b.subdomainA.example.com
a.subdomainA.example.co.uk
b.subdomainA.example.co.uk
Website B:
*.subdomainB.(any valid tld or subdomain-tld combination, or perhaps a list of domain names?)
a.subdomainB.example.com
b.subdomainB.example.com
a.subdomainB.example.co.uk
b.subdomainB.example.co.uk
I have looked into Apache Mod_Rewrite and Mod_vhost_alias
Any suggestions?
@Grumpy:
Thanks for your answer but I need a solution that will work for a larger number of domain.tld’s, preferably something that is dynamic similarly to how mod_vhost_alias works with the filesystem
If I were to use ServerAlias I would need something like *.subdomainA.* (to match things like blah.subdomainA.com and also *.subdomainA.co.* (to match things like blah.subdomainA.co.uk)
Best answer:
Answer by Grumpy
You can accomplish the same thing with ServerAlias in the vhost configuration.
NameVirtualHost *:80
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /var/www/domain
Give your answer to this question below!
Share and Enjoy
Recent Comments