[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apache2 configuration question

Roberto C. Sanchez wrote:

Today I switched my server from running apache to apache2.  I have been
wondering about something that I was never able to get working quite
right in apache and thought there might be a way to do it with apache2.
The DNS for my domain has an entry for *.familiasanchez.net making it a
CNAME to santiago.familiasanchez.net (my main server).  I would like for
apache to take to redirect requests for *.familiasanchez.net to
familiasanchez.net, unless I have a vhost defined for *.  For example,
if I have defined a vhost called foo.familiasanchez.net, I want
foo.familiasanchez.net to serve up the correct pages, but
bar.familiasanchez.net to redirect to familiasanchez.net.  I know how to
setup redirects based on what is to the right of the hostname, but I
don't know how to accomplish what I want.  Any suggestions?
Well I haven't tried the "unless I have a subdomain defined" part but I think it would work something like this:
A vhost for your domain
A vhost for each subdomain you want
A vhost for *.domain

But they have to go in that order! In other words, if you're using Debian's (crazy) a2en-site stuff, and you put all these definitions in different files, you might not get them in the right order. So, I would make one file for the vhost definitions for this particular domain and just list them in the order you want.


Reply to: