Heim > Artikel > Backend-Entwicklung > nginx rewrite rule解决思路
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 />