摘自:ThinkPHP 完全开发手册 3.1

  在Nginx低版本中,是不支持PATHINFO的,但是可以通过在Nginx.conf中配置转发规则实现:

location /{// …..省略部分代码
    if(!-e $request_filename){
    rewrite  ^(.*)$  /index.php?s=$1  last;
    break;
}
}

   其实内部是转发到了ThinkPHP提供的兼容模式的URL,利用这种方式,可以解决其他不支持PATHINFO的WEB服务器环境。


   如果你的ThinkPHP安装在二级目录,Nginx的伪静态方法设置如下,其中youdomain是所在的目录名称。

location /youdomain/{
    if(!-e $request_filename){
    rewrite  ^/youdomain/(.*)$  /youdomain/index.php?s=$1  last;
}
}