thinkphp 在nginx服务器上url重写失败,找不到路径

在nginx中thinkphp的url重写总是找不到路径,会报404的错误

 

用原生态的url  

index.php?m=Index&a=index//用这种路径可以正常访问

 

但是index.php/Index/index这种方式就会报404错误

一、thinkphp的配置文件

'URL_ROUTER_ON' => true, //开启路由
'URL_HTML_SUFFIX' => 'html', //伪静态后缀
'URL_MODEL' => 2, //该模式重写url,去掉index.php

 

二、配置nginx:

# 在server段location /加载此内容

location / { 

    if (!-e $request_filename) { 

        rewrite  ^(.*)$  /index.php?s=$1  last; 

        break;   

    } 

}

 

posted @ 2015-08-31 11:17  到站了  阅读(1044)  评论(0编辑  收藏  举报