天天看點

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;   

    } 

}

thinkphp 在nginx伺服器上url重寫失敗,找不到路徑