httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Andersson" <rob...@profundis.nu>
Subject Re: [users@httpd] addhandler changes between Apache 1.3 and 2.0
Date Fri, 18 Jun 2004 09:48:50 GMT
Alois Treindl wrote:
> # in Apache 2.0, the Addhandler directive does not work to give .htm
> # requests to xa.cgi if the requested file is missing.
> # for this case, we use this extra redirect
> RewriteCond /www/docs/%{REQUEST_FILENAME} \.htm$
> RewriteCond /www/docs/%{REQUEST_FILENAME} !-f
> RewriteRule /(.*) /cgi/xa.cgi/$1 [L,R]
>
> If I leave the  [R] flag out, the redirect is done to
> /www/docs/cgi/xa.cgi
> which of course does not work, as the /cgi/ directory is not within
> the documents directory /www/docs

As long as you have the [R] flag, the user *will* se the rewritten URI, so
you'll need a way to get rid of it.

I have not utilized mod_rewrite in that way, but the docs suggests that the
substitution can be a real filesystem path, so you might be able to just do:

    RewriteRule /(.*) /path/to/cgi/xa.cgi/$1 [L]

I'm asuming /cgi is an alias of some sort, so as indicated by the docs:

    "'passthrough|PT' (pass through to next handler)
     This flag forces the rewriting engine to set the uri field of the
internal
     request_rec structure to the value of the filename field. This flag is
     just a hack to be able to post-process the output of RewriteRule
     directives by Alias, ScriptAlias, Redirect, etc. directives from other
     URI-to-filename translators. [...]"

Replacing [R] with [PT] might do the trick also, and seems preferable.

Regards,
Robert Andersson


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message