The order of virtual hosts in users httpd.conf

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
15,237
Location
GMT +7.00
Hello,


First of all, I'd like to know, why domains come first and subdomains come only after them in users' httpd.conf? Why the things are designed in this way?

Secondly, I'd like to have an option to change the order, or just have the virtual hosts come in another order. I mean, virtual host for domain would go the last, and virtualhosts for its subs would be coming prior to it.
 
Hello,

1) It's mainly because of SSL certificates.. although for subdomains, they'd be using the same certificate anyway, so wouldn't really matter if the order changed, but that was the thought process at the time of implementation.

The only case I know of where the order would matter would be for the case of a wildcard subdomains, where adding a wildcard needs to be very last. For that case, there are sneaky ways of going about it... namely, create a subdomain called "zzzz", and then use something like:
Code:
|*if SUB="zzzz"|
ServerAlias *.|DOMAIN|
|*endif|
which pretty much guarantees that it will be last, so the other subdomains can continue to work seperately from the wildcard.
Related

2) An order option could be considered if there were a specific reason for it. Can you describe the particular scenario you've got that needs it?

John
 
Back
Top