Is it possible to configure Apache to allow different prefixes (instead of www) to map to different directories in the file system? For example...
I have two different environments on my webserver:
/home/me/test/web : Test Environment
/home/production/web : Production Environment
I would like these to map to these urls:
test.mysite.com -> /home/me/test/web
prod.mysite.com -> /home/production/web
However, nothing I've tried with VirtualHosts has worked:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName test.mysite.com
** Some SetEnvs **
</VirtualHost>
<VirtualHost *:80>
ServerName prod.mysite.com
** Different SetEnvs **
</VirtualHost>
This throws the following error:
[warn] _default_ VirtualHost overlap on port 80, the first has precedence
Is this kind of configuration even possible with Apache, or am I doing something wrong? Also, some clarification - simple rewriting with a virtualhosts file probably won't fit either. It works for straight directory stuff, but then I can't use any SetEnv directives like I could within a VirtualHost section.
Should be
:
not.
: