[lug] Strange Apache VirtualHost behavior

David Morris lists at morris-clan.net
Mon Nov 22 15:32:26 MST 2004


On Mon, Nov 22, 2004 at 02:54:06PM -0700, David Anselmi wrote:
> >If I go to this one:
> >
> >    http://david.morris-clan.net/foo
> >
> >(Note the lack of a trailing '/') I get redirected here:
> >
> >    http://belsambar.morris-clan.net/foo/
> 
> No trailing slash gives me a 404 at the moment.  Perhaps you want mod_dir?

Aye, you get 404 because
http://belsambar.morris-clan.net/foo/ does not exist.  If
you add the trailing '/' you stay in http://david.mo... and
don't get 404.  I do have mod_dir being used.

> [...]
> >NameVirtualHost 66.93.122.13
> >
> ><VirtualHost 66.93.122.13:80>
> >	ServerAlias		morris-clan.net
> >	ServerAlias		*.morris-clan.net
> 
> Should the first of those be ServerName rather than Alias by any chance?

It should yes....but doesn't change anything apparently

A few more experiments make it even more interesting:

No matter what virtual host is placed first, the hostname in
the URL is redirected to 'belsambar.morris-clan.net' (the
name of the computer which, incidentally, doesn't exist
anywhere in the config file) and the DocumentRoot is taken
from the first VirtualHost entry.

--David



More information about the LUG mailing list