nginx 中这条rewrite规则怎么写?

maya8maya85 发布于 2016/10/12 12:18
阅读 297
收藏 0

【开源中国 APP 全新上线】“动弹” 回归、集成大模型对话、畅读技术报告”

Nginx + Dsicuz的已有规则
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
if (!-e $request_filename) {
#return 404;
}   


现在要这样,参数是固定的, 就是说没有变量
访问 跳转到
www.xxx.com/pro/abc     www.xxx.com/pro.html?mode=view&plid=1  
www.xxx.com/pro/efg     www.xxx.com/pro.html?mode=view&plid=2

www.xxx.com/pro/hij     www.xxx.com/pro.html?mode=view&plid=3

请问这条规则怎么写?

加载中
0
天酷
天酷

大概这样

rewrite /pro/abc /pro.html?mode=view&plid=1 last;

OSCHINA
登录后可查看更多优质内容
返回顶部
顶部