• rewrite
location / {
    rewrite ^/detail/(.*).html$ /index.php?t=detail&id=$1 last;#permanent
    rewrite ^/list/(\w+)/(\w+)/(\w+).html$ /index.php?t=list&id=$1&cid=$2&p=$3 last;
    rewrite ^/list/(\w+)/(\d+).html$  /index.php?t=list&id=$1&cid=0&p=$2  last;
}
  • 调试
server{
....
    error_log  logs/error1.log  notice;
    rewrite_log     on;    
}
  • 301跳转
if (!-e $request_filename){
    return 301 http://localhost:801/?$request_filename ;
}

常用Rewrite伪静态法则

#拆分路径和参数
rewrite ^(.*)?(.*)$ /in.php?$1$2 last;