httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Ralf S. Engelschall)
Subject Re: Virtual Hosting w/ mod_rewrite \(complete solution\?\)
Date Fri, 27 Feb 1998 11:58:11 GMT

In article <> you wrote:
> At 07:50 PM 2/26/98 -0800, Dean Gaudet wrote:
>>On Thu, 26 Feb 1998, Brian Behlendorf wrote:

>>For this setup you want mod_rewrite... because
>>(a) you'll be reinventing the wheel

> How?  I think this can be done easily without mod_rewrite, because 1)
> there's no need for any sort of "rewriting", logically, and 2) there's no
> need for doing any regex work.  And just logically, this seems like
> something much more like what mod_userdir does than what mod_rewrite does.

This is an acceptable point, Brian. The emulated vhost-stuff is not directly
for what mod_rewrite was designed. But on the other hand: for exactly what was
it designed? To help solving any type of problems which have something to
do with the mapping of incoming requests to filenames. And from this point
of view is ok to use mod_rewrite here... ;-) 

>>(b) mod_rewrite can rewrite to a default page if none of the hosts match
>>the Host: header

> ErrorDocument 404?

Correct, but:

b2) mod_rewrite can even rewrite to a default _docroot_ if none of the hosts
match the Host: header or if no Host: header is given.

> I love mod_rewrite.  There are many things it's enabled me to do, which
> would have been very complex to do otherwise.  I'm totally happy it's a
> part of the core distribution, and that Ralf is such an active contributor.

Thanks, Brian.

> Let me put it like this - if we could encapsulate all those mod_rewrite
> directives into a simple

> VHostMappedServerRoot /www

> we'd gain a *lot*, even if under the hood it was mod_rewrite.

Ahhh, now I see your exact point here, Brian. Because emulated virtual hosting
is something a lot of people want (at least those who have to do mass virtual
hosting), we need a simplified way of configuring the solution. Hmmm... yes,
this is a good point. 

Here the idea of the module mod_rewrite_compat comes back into my mind: We
could create a mod_rewrite_macro module with the same idea. It just translates
simple and nice one-line config rules into the corresponding RewriteCond,
RewriteRule directives internally by just calling the cmd_rewriteXXX()
functions from mod_rewrite from within its config command handlers. Then the
backward-compatibility for mod_userdir, mod_alias, etc. ist just a set of
macros in this more generic module...

>> Hey guys make sure that absoluteURI hosts are handled properly... I think
>> they are with UseCanonicalName on.  I haven't checked.

> Oh, another point - I'd rather leave it up to the core to determine just
> "what" virtualhost the connection is for, and for the module to translate
> that into a directory path, than have the module have to track HTTP evolution.

Yeah, this is ugly. I know. But Deans recent patch for absoluteURI support
goes in this direction. It at least removes the DNS-stuff from mod_rewrite
which is a first step towards this goal.

                                       Ralf S. Engelschall

View raw message