perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Fulmer" <j...@joedog.org>
Subject URI redirection
Date Fri, 21 Sep 2007 17:06:00 GMT
Hello list!

I have a functional requirement that is currently delivered with
mod_rewrite maps but it would be much more maintainable with something
that offered programmatic logic. I started to look at mod_perl and I
suspect it might be perfect. I'm using mod_perl version 1.9.x

I was hoping someone can push me in the right direction. At this point I
know enough to be dangerous ;-)

I'll have a function that takes a URI as an argument. The function will
look for that URI in a configure file(s). If it finds a match, it will
return a URI  to where the client should be redirected. If it doesn't find
a match, then the client should go to the URI they requested. Let's call
the function uri_map in the pseudo code below:

$redirect = uri_map($r->uri);
if(defined($redirect)){
  $r->header_out(Location => '/env.jsp');
  return REDIRECT;
} else {
  # and I'm stuck here;
  # allow the request to pass thru to the server
  # so that the client goes to the requested URI.
}

I'd like to invoke this code for *every* request made to the server. To
meet that requirement, it seems like <Location /> is a good place to
reference the handler.

Any insight would be appreciated.

Cheers,
Jeff


Mime
View raw message