1. 程式人生 > >nginx rewrite正則子組最多匹配到$9

nginx rewrite正則子組最多匹配到$9

spl html splay erb ice line display and 需要

nginx rewrite正則匹配()匹配子組最多匹配到$9,就是從$0到$9

當需要匹配更多子組時,可通過變量來實現

if ($uri ~ ^/forum-15/sortid-74/(.*?)(lastpost|dateline)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$){
set $orderby $2;
set $mdate $3;
set $workhours $4;
set $pricerange $5;
set $page $6;

rewrite ^([^\.]*)/forum-15/sortid-74/(\w+)/(\w+)/(.*?)/(\w+)/(\w+)/(\w+)/(lastpost|dateline)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=15&filter=sortid&sortid=74&epuipment=$2&brand=$3&model=$4&province=$5&city=$6&district=$7&mdate=$mdate&workhours=$workhours&pricerange=$pricerange&page=$page&orderby=$orderby last;
}

nginx rewrite正則子組最多匹配到$9