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

Re: apache2 configuration question

On Sat, Sep 03, 2005 at 09:22:00PM -0400, Scott wrote:
> 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?
> This is how I do it, and it works great:
> #first the default Vhost:
> NameVirtualHost
> <VirtualHost>
> ServerName server.domain.net
> DocumentRoot /web/defaultwebfiles/html
> </VirtualHost>
> #then the named hosts that go to other document roots:
> <VirtualHost>
> ServerName Yoururl.domain.com
> DocumentRoot /web/yoururlfiles/html
> <etc>

Except that all queries that are not answered by the other vhosts go to
the default, which is what I am trying to avoid.  I ended up figuring it
out by putting a dummy vhost that redirects to my "main" server.


Roberto C. Sanchez

Attachment: pgp0Ieb0OhuqG.pgp
Description: PGP signature

Reply to: