一个nginx的url重写问题

访问:
http://a.com.cn/index.php?s=b/index/hi.html
变成:
http://a.com.cn/bb/index.php?m=index&n=hi

重写规则:
rewrite "^/index.php?s=b/(.)/(.).html$" /bb/index.php?m=$1&n=$2 last;

但是不好用,没看出问题出在哪.....

阅读 1.9k
1 个回答

圆点.只代表一个字符,要加*号才行
试试这个

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题