Mobile app version of vmapp.org
Login or Join
RJPawlick198

: Multiple VirtualHosts with wildcards I have a three VirtualHosts. The second two utilize wildcards. www.example.com *.sites.example.com (i.e. foo.sites.example.com) *.*.sites.example.com (i.e. foo.bar.sites.example.com)

@RJPawlick198

Posted in: #Apache #Virtualhost

I have a three VirtualHosts. The second two utilize wildcards.

example.com *.sites.example.com (i.e. foo.sites.example.com)
*.*.sites.example.com (i.e. foo.bar.sites.example.com)


For the second two, I tried:

ServerName example.com
ServerAlias *.example.com


and

ServerName example.com
ServerAlias *.*.example.com


Problem is *.example.com gobbles up *.*.example.com. As maybe a hack, I put *.*.example.com before *.example.com in my httpd.conf file.

Is what I did the proper way to do this, or is there a more official way?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @RJPawlick198

1 Comments

Sorted by latest first Latest Oldest Best

 

@Barnes591

You did it the right way.
Apache always takes the first VirtualHost if multiple entries match.

For more information about Virtual Host Matching look at the official documentation: httpd.apache.org/docs/2.4/vhosts/details.html

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme