Hi,

I would not be surprised if this problem has arisen due to me expecting
more from Apache+mod_perl than it's capable of.

The server is running Apache 1.3.mumble with mod_perl and mod_php. The
site has been entirely built in PHP, by somebody else. They want the
facility for http://foo.bar.com/david to redirect to
http://foo.bar.com/?page=publicprofile.php&name=david .

As I understand it, this needs to run at the URI Translation stage in
Apache, which is exposed thru mod_perl via PerlTransHandlers. In the
event that the request doesn't match these criteria, it needs to return
control to Apache in order that the page gets served as normal (through
mod_php). Without the handler in place, this all works, but the /david
form doesn't, since there's no code in place to do it.

Basically, I have a handler Apache::Publicprofile::Redirector::handler()
which is in Apache/Publicprofile/Redirector.pm

It is loaded in the site Apache config like:

##begin apache config excerpt##
[ inside a VirtualHost block, outside Location block ]

PerlModule Apache::Publicprofile::Redirector

SetHandler perl-script
PerlTransHandler Apache::Publicprofile::Redirector
PerlSendHeader Off
##end apache config excerpt##

I'm attaching the module, with a slight change to remove the actual
webserver details, as requested by the guy whose project this is. I hope
the code is self-explanatory, please query any bits that aren't.

Currently, the behaviour exhibited is as follows:

In any case, regardless of whether the handler is returning OK or
DECLINED, Apache tries to serve the *source* of /index.php - ie without
running it through mod_php.

Is the issue perhaps that PerlTransHandler is the wrong stage to run at?
Is it even possible to do what they want to do?

FWIW, changing $r->path_info to $r->uri changes from 404 Not Found to
400 Bad Request. It was suggested that path_info may not be available
yet by the trans phase.

Any help _much_ appreciated - I'm lost here!

/joel

-- 
S. Joel Bernstein
joel at fysh dot org

Attachment: Apache-Publicprofile-Redirector.pm
Description: Perl program

Reply via email to