I recently added a virtual host config to my apache which is using mod_vhost_alias to route requests to domain-like directories. If the directory exists everything works just fine. Now my thought was, when I call a domain which is routed to my apache, but no corrsponding virtual document root exists, the request would be handled by default host. But it isn“t. Is there a solution to do this without using mod_rewrite?
This is my dynamic host config:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerAlias *
UseCanonicalName Off
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/log/apache2/dhost_access.log vcommon
VirtualDocumentRoot /var/www/%0
VirtualScriptAlias /var/www/%0
</VirtualHost>
And this is my default host:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>