httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <>
Subject Re: [users@httpd] combining mod_rewrite and mod_vhost_alias
Date Fri, 30 Jan 2004 13:33:28 GMT

On Fri, 30 Jan 2004, Damian Meyer wrote:
> Now for the hard part, I also want www.domain.tld to return the same
> index.html file, without having a symbolic link at
> /home/sites/w/w/w/www.domain.tld/ which defeats the purpose of splitting
> up into three layers of directories.  Hence my question about
> mod_rewrite:  How can I strip the www. off the hostname before passing
> it to mod_vhost_alias?

It may be possible to do what you want, but I'm not sure.

What I would recommend is one of the following:

1. Use the redirect solution.  I know you said you don't want this, but in
general it is a bad idea to have two different names mapping to exactly
the same content.  The redirect assures that there is only a singal
canonical name in search engines, caches, etc.

2. Do the whole thing in mod_rewrite.  Everything that mod_vhost_alias can
do, mod_rewrite can also do.  Plus mod_rewrite has a ton more flexibility,
including the ability to do things conditional on the hostname starting
with "www".  There are some examples in the virtual host and mod_rewrite
docs.  Combining mod_rewrite and mod_vhost_alias is a very complicated
thing to do, since you need to be intimately familiar with the internal
workings of apache to know how they will interact.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message