http://www.perlmonks.org?node_id=379712


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 -

http://example.com/news/20021031/09/index.html
but you need convert it as
http://example.com/perl/news.pl?date=20021031&id=09&page=index.html
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/news.pl"); $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.

---
Schiller

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