[WEB4LIB] Nitty Gritty Apache question

Richard L. Goerwitz III richard at goerwitz.com
Thu Apr 26 08:46:27 EDT 2001


Thomas Dowling wrote:

> The [Apache] "RewriteRule" directive used to modify URLs without trying
> to do any interpretation on them. Given a line like this in httpd.conf:
> 
>   RewriteRule ^/foo/(.*) /bar/$1
> 
> Any request for a URL in the /foo directory would be redirected to the
> /bar directory, but nothing else would happen to the URL.
> 
> In 1.3.19, I'm seeing Apache hex-encode characters it considers unsafe
> while doing the rewrite...
> 
> The problem is that Apache 1.3.19 considers the percent sign unsafe, so if
> I request '/foo/script.cgi?%22alpha+beta%22' I get redirected to
> '/bar/script.cgi?%2522alpha+beta%2522'

I haven't run into precisely this problem, but I can see how it
would be debilitating.  Please let us know if you manage to work
around the problem - and if so, how.

Here are some things I'd try; no, I haven't tested these, and I
would be very interested, as noted, in hearing how you solve this
problem:

  1) use an internal redirect, rather than an external one,
     RewriteRule ^/foo/(.*) /bar/$1 [R]

  2) use a translation handler, like mod_alias -
     Alias /foo/ /path/to/bar/

  3) use mod_perl to do whatever redirects or translations you
     need done

-- 

Richard Goerwitz                               richard at Goerwitz.COM
tel: 401 438 8978


More information about the Web4lib mailing list