Home  >  Article  >  Backend Development  >  nginx rewrite rule解决思路

nginx rewrite rule解决思路

WBOY
WBOYOriginal
2016-06-13 12:09:50951browse

nginx rewrite rule
实现下面的rewrite:
abc.domian.com/sort/2 => abc.domian.com/index.php?act=sort&name=abc&id=2

nginx.conf里面这么写是正确的吧:
rewrite ^/(.+)\/(\d+)\/?$ /index.php?act=$1&id=$2 last;

------解决思路----------------------
基本可以确定你用的CI框架

<br /><br /><br />if (\$request_uri !~ ^/(html<br><font color='#FF8000'>------解决思路----------------------</font><br>static<br><font color='#FF8000'>------解决思路----------------------</font><br>favicon/.ico<br><font color='#FF8000'>------解决思路----------------------</font><br>robots/.txt<br><font color='#FF8000'>------解决思路----------------------</font><br>index/.php.*) ) {<br />                        rewrite ^/(.*)\$ /index.php/\$1 last;<br />                        break;<br />                }<br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn