Apache mod_rewrite URI->URI remapping?

Apache mod_rewrite URI->URI remapping?

Post by Viktor Fougste » Fri, 31 Oct 1997 04:00:00


I'm currently running Apace 1.1.1 (old, I know) with mod_rewrite,
which was at installation time separate from the Apache distribution.
I use mod_rewrite together with cgiwrap and uncgi to enable users to
run their own cgi-programs.

Now i finally got around to compiling Apace 1.2.4, and suddenly
this doesn't work anymore, beacause mod_rewrite used to rewrite URI->URI
(and was, in my installation, the first module to be run,) but now it
only seems to rewrite URI->filenames.

Is there any way for me to make the current version rewrite one URI to
another URI inside Apache before any other processing takes place? Or
was this functionality removed from mod_rewrite when it was
incorporated into the distribution?



==== Info that might be interesting ====

Here is the way it is currently set up here:

mod_rewrite is the highest priority module in httpd.

It rewrites any uri inside apache like /~user/cgi-bin/program to
/cgi-bin/cgiwrap/user/program (since cgiwrap wants the path to look
like this, and users have a hard enough time figuring out the whats
and hows of CGI as it is.)

It also rewrites any uri like /~user/cgi-bin/program.form to
/cgi-bin/uncgi/cgiwrap/user/program.form, which is a nice way to have
_one_ uncgi for all users (uncgi takes both GET and POST form data and
puts it into environment variables. It can only execute programs in
one specific directory, specified at compiletime.)

/~user/cgi-bin/nph-program gets rewritten to

Cgiexec is turned _off_ for all users' home directories, to avoid them
bypassing the wrapper.

I'd really like for this to be transparent for the users. They do not
need to know _how_ their programs run as themselves, nor do they need
to know _how_ uncgi is called or what it is. They only need to know
that cgi-programs whose names end in .form gets special
treatment. This is to simplify the process of using CGI as much as

I am aware of that suEXEC probably would work, but I would really like
to make the .form-construct entirely transparent to them as well.

--|    Viktor Fougstedt, Orkesterg. 21, 421 39 V. Frolunda, Sweden     |--
--|               http://www.dtek.chalmers.se/~d2viktor/               |--
--| ...soon we'll be sliding down the razor blade of life. /Tom Lehrer |--