[thelist] Apache + Subdomains

Carl Meyer carljm at goshen.edu
Fri Mar 12 00:05:28 CST 2004


On Thu, 11 Mar 2004, Adrian Gonzales wrote:
> I am using apache as my webserver to host several websites. I use
> Virtual Hosts for each domain and subdomain. I was wondering if there is
> a more efficient way of assigning sub domains rather than a virtual host
> for each one. And is there any way to make a virtual host answer more
> than one domain, ie: clearspanmedia.com, www.clearspanmedia.com

hi Adrian,

Not sure if this is what you mean by "more efficient way of assigning sub
domains", but you might want to look at 

http://httpd.apache.org/docs/vhosts/mass.html

It describes ways to host a large number of very similar virtualhosts
without maintaining reams of almost-identical VirtualHost entries.  

Another thing that I've done (not described in the Apache docs) is to point
a wildcard virtualhost (ServerAlias *.example.com) at a PHP script where I
look at the Host: header in order to serve up dynamic content specific to
the subdomain requested.

HTH,

Carl



More information about the thelist mailing list