Dynamic subdomains not working

New to mod_rewrite? This is a good place to start.

Dynamic subdomains not working

Postby coda » Sat Oct 08, 2005 4:53 pm

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.
coda
 
Posts: 6
Joined: Thu Oct 06, 2005 7:03 pm

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 48 guests

cron