FloRet88
If I understood well, you want a new option that make possible to enable wildcard entry for the domains and subdomains. Basically put, when the option is checked on, the generated vhost, here for a domain, would looks as follows:
- <VirtualHost <ip>:80>
- ServerAdmin webmaster@domain.tld
- ServerName domain.tld
- ServerAlias www.domain.tld *.domain.tld
- DocumentRoot "/var/www/virtual/domain.tld/htdocs"
- ...
- </VirtualHost>
Right?
Of course, it should be easy to do that as long as you're not asking me to manage/detect possible conflicts between various vhosts. For instance, let's imagine the following scenario:
One customer do the following:
- Create the domain.tld domain with the wildcard option enabled
- Create the sub.domain.tld
Then this would produce the following vhosts:
- <VirtualHost <ip>:80>
- ServerAdmin webmaster@domain.tld
- ServerName domain.tld
- ServerAlias www.domain.tld *.domain.tld
- DocumentRoot "/var/www/virtual/domain.tld/htdocs"
- ...
- </VirtualHost>
- <VirtualHost <ip>:80>
- ServerAdmin webmaster@domain.tld
- ServerName sub.domain.tld
- ServerAlias www.sub.domain.tld
- DocumentRoot "/var/www/virtual/domain.tld/sub/htdocs"
- ...
- </VirtualHost>
The problem here is that both vhost would collide. I don't remember if there is a precedence for apache when an alias entry such as *.domain.tld has been added in one vhost and that another vhost collides with it such as sub.domain.tld. The best thing would be that if there is a non-wildcard entry such as sub.domain.tld, that one take precedence over the *.domain.tld wildcard entry. The behavior need to be checked. As far as I known, precedence for apache2 is based on natural sorting rather than entry matching type. I need to check that. That why I say, I can implement that feature easily as long as you don't ask me to manage possible conflicts. My thinking is that a customer should be smart enough to not create any subdomain if the wildcard option is enabled for the parent domain.
If you agreed, I can add that feature today, else, we need postpone...
See also