You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1998/02/15 13:03:01 UTC

Re: mod_rewrite \\\(was Re: 1.2.6\\\)

In article <Pi...@twinlark.arctic.org> you wrote:

> If I found regex substitution to be a problem on my server I would write
> mod_rewrite_flex which includes a full flex parser to parse URLs as fast
> as they damn well could be ;)  Nothing like parsing all of your regexs in
> parallel.  I don't think the various translation modules are speed
> problems for most folks. 

>> >>  Yuck, I wasn't even aware of this brokenness in mod_userdir.  I personally
>> >>  wish we'd just dropped mod_userdir et al for mod_rewrite ages ago.  But
>> >>  whatever.  I'll go put a bandaid on it. 
>> 
>> > Is there a reason why mod_userdir and mod_alias are still in use?
>> > mod_rewrite can easily replace both modules and writing some
>> > wrapper functions to provide backward compatibility to the userdir
>> > and alias directives shouldn't be a problem. In fact Ralf demonstrated
>> > that this is possible some time ago with his mod_rewrite_compat module...
>> 
>> Yes, this module mod_rewrite_compat.c could be updated and will work fine, I
>> think. But as Ken said, some users driving small and fast Apaches perhaps
>> don't like the overhead of the regex matches. Has someone performance values
>> which actually say that the regex matches are _dramatically_ slower then using
>> a substring match in practice?

Same here, I use a lot of non-trivial RewriteRules an all of my servers and
never discovered any dramatical performance lacks due to regex matches.  But
Kens point is still ok, some people really want simple and high-performance
substring matching instead of the regex matching.

To really let mod_rewrite replace mod_userdir and mod_alias, we would
have to do the following:

1. Add a RewriteRule flag which forces plain prefix matching 
   for the RewriteRule-pattern (arg 1) instead of real regex matching.

2. Perhaps add some more caching stuff to mod_rewrite (map lookups
   are already cached for speed): We can cache successfully matched
   URL prefixes in a hash list to avoid regex matches.

3. Update the old mod_rewrite_compat so it is up-to-date with
   the current features and directives of mod_userdir and mod_alias: This
   module just provides the same directives but maps them internally into
   equivalent RewriteRule directives.

Even if we don't remove mod_userdir and mod_alias updating this
mod_rewrite_compat module and placing into modules/experimental/ would be nice
I think, wouldn't it? 
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com