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

Re: apache2 configuration question



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
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 192.168.0.102:80
<VirtualHost 192.168.0.102:80>
ServerName server.domain.net
DocumentRoot /web/defaultwebfiles/html
</VirtualHost>


#then the named hosts that go to other document roots:

<VirtualHost 192.168.0.102:80>
ServerName Yoururl.domain.com
DocumentRoot /web/yoururlfiles/html
<etc>


hth
Scott
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
 
iD8DBQFDGlFRDYYGMeaefyERAmpTAJ9fVRTHWZ4XPqXiU+LAXJ2IX8mSdACgg6Oo
iVaQsm/SZCnB1lZkZWMHfoE=
=phZM
-----END PGP SIGNATURE-----



Reply to: