I have Apache 2 and PHP 4x installed under Windows XP. I'm trying to get name-based virtual hosting working under Apache, and ultimately to allow for dynamic subdomains.
This is what I have in my httpd.conf:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "D:/htdocs/foo/"
ServerName www.foo.com
ServerAlias *.foo.com
</VirtualHost>
And in my windows/system32/drivers/etc/hosts file:
127.0.0.1 foo.com
When I visit "http://foo.com" in a browser, then I get the correct page. What I want though, is to be able to type anything for a subdomain, for example, http://whatever.foo.com or http://www.foo.com - and they should all load up the same. Is this even possible without adding additional subdomain entries to the hosts file or elsewhere?
The subdomain won't be used to change to a different folder on the server, I just need it as a variable with which I can query a database and produce different results.
Am I missing anything?
Thanks in advance.