鍍金池/ 問答/PHP  Linux  網(wǎng)絡(luò)安全/ 一個(gè)nginx的url重寫問題

一個(gè)nginx的url重寫問題

訪問:
http://a.com.cn/index.php?s=b/index/hi.html
變成:
http://a.com.cn/bb/index.php?m=index&n=hi

重寫規(guī)則:
rewrite "^/index.php?s=b/(.)/(.).html$" /bb/index.php?m=$1&n=$2 last;

但是不好用,沒看出問題出在哪.....

回答
編輯回答
墨小羽

圓點(diǎn).只代表一個(gè)字符,要加*號(hào)才行
試試這個(gè)

rewrite "^/index.php?s=b/(.*)/(.*).html$" /bb/index.php?m=$1&n=$2 last;

2017年4月18日 05:48