Wildcard Subdomain Exceptions Wildcard Subdomain Exceptions apache apache

Wildcard Subdomain Exceptions


Your .htaccess does nothing useful, as Apache is probably configured with DirectoryIndex index.php. Well, it does move domain.com/a to domain.com/index.php, but I doubt that is what you want.

Your wildcard virtualhost works because you probably have ServerAlias *.domain.com in your configuration, or a single virtualhost and DNS pointing to the address of your server. (When you have a single virtualhost, it shows up for any request, and the first listed virtualhost is the default one)

You have to create new VirtualHosts for the static domains, leaving the default one as, well, the default one :)

Check these tutorials that explain it all.


You'll have to configure apache for those static sub-domains. The "catch-all" site will be the default site configured, so that one will catch the other ones.


I'm not sure I understand completely what you need to accomplish, but it might helpful to setup virtual domains within your Apache configuration file. You can map them to folders on the drive with different applications installed. Each virtual domain is treated much like a root directory. I have my development environment setup locally on my Windows machine a lot like this:

NameVirtualHost *:80# Begin virtual host directives.<VirtualHost *:80># myblog.com virtual host.ServerAdmin webmaster@myblog.comDocumentRoot "c:/apache_www/myblog.com/www"ServerName myblog.comServerAlias *.myblog.comErrorLog "c:/apache_www/myblog.com/logs/log"ScriptAlias /cgi-bin/ "c:/apache_www/myblog.com/cgi-bin/"<Directory "c:/apache_www/myblog.com/www">    Options Indexes FollowSymLinks    AllowOverride All    Order allow,deny    Allow from all</Directory></VirtualHost>

If this does not help get you on the right track, then try researching the VirtualHost directive to come up with a solution. I find trying to do all this in an .htaccess to be cumbersome and difficult to manage.