Groups
Conversations
All groups and messages
Send feedback to Google
Help
Training
Sign in
Groups
netkiller
Conversations
About
apache+mod_perl实现url rewrite
1 view
Skip to first unread message
netkiller
unread,
Sep 28, 2008, 1:48:12 AM
9/28/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to netkiller
[web开发] apache+mod_perl实现url rewrite
2008年07月21日 星期一 17:45
相信apache的mod_rewrite模块都很熟悉了,今天这儿换个思路,利用mod_perl来实现下,发现竟然是如此的简单!
首先得保证apache已经安装了mod_perl模块,具体安装配置可以看上一篇文章哦。
修改下http.conf配置,添加一下内容:
PerlTransHandler MyTrans # MyTrans 这个是自己添加的处理模块名
具体MyTrans.pm脚本如下:
package MyTrans;
use strict;
use Apache2::Const qw(DECLINED);
sub handler {
my $r = shift;
my $uri = $r->uri;
my ($id) = ($url =~ m|^/news/(.*)\.html|)
$r->uri("/news.php");
$r->args("id=$id");
return Apache2::Const::DECLINED;
}
1;
实现就是:/news/12345.html => /news.php?id=12345
Reply all
Reply to author
Forward
0 new messages