Your skill will accomplish what the force of many cannot |
|
PerlMonks |
mod_rewrite + CGI.pm in "reverse"?by hacker (Priest) |
on Mar 11, 2005 at 15:22 UTC ( [id://438673]=perlquestion: print w/replies, xml ) | Need Help?? |
hacker has asked for the wisdom of the Perl Monks concerning the following question: I've written a new mod_perl-driven application which takes a URI (with the scheme of news://, http://, and ftp:// so far), a limit, and some other params, and passes them into my script. CGI.pm splits off param(), validates the input, and passes the params off to the proper subs, based on the values of the data found. So far, so good... What I'm trying to figure out, is a way to take the following style URI fragment, which includes the "raw" params and query string: http://www.example.com/?type=news&feed=news://comp.lang.c&limit=10 ...and turn it into something "nicer" for the user to remember and use in the future, like this: http://www.example.com/news/comp.lang.c/10 I'm not the best with mod_rewrite, and I think it can help here, but I'm not sure how to "split" the fragments passed in on '/', and pass those to CGI.pm to parameterize. Would something like this help? RewriteRule ^/(.*)/(.*)/(.*) /index.pl?type=$1&feed=$2&limit=$3 Or perhaps there's a better approach? Ideas and suggestions are welcome.
Back to
Seekers of Perl Wisdom
|
|