Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Perl file names and extensions

by nite_man (Deacon)
on Aug 03, 2004 at 15:51 UTC ( #379712=note: print w/replies, xml ) Need Help??

in reply to Perl file names and extensions

Let's see how do it with mod_perl (example from mod_perl documentation):
This is an URL on website -
but you need convert it as
You can use for that simple mod_perl handler:
package MyApache::RewriteURI; use strict; use warnings; use Apache::RequestRec (); use Apache::Const -compile => qw(DECLINED); sub handler { my $r = shift; my($date, $id, $page) = $r->uri =~ m|^/news/(\d+)/(\d+)/(.*)|; $r->uri("/perl/"); $r->args("date=$date&id=$id&page=$page"); return Apache::DECLINED; } 1;
Also, you should add in http.conf:
PerlTransHandler +MyApache::RewriteURI
So, first URL is easier to understand for user than second. Also, based on this you can create something like selector to process and redirect HTTP requests according your rules.


It's only my opinion and it doesn't have pretensions of absoluteness!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://379712]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2021-06-22 11:34 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (104 votes). Check out past polls.