1. 程式人生 > >thinkphp部署服務器後出現404錯誤

thinkphp部署服務器後出現404錯誤

偽靜態 last rul 情況 block cond 開啟 engine 分割

關於404幾種常見的錯誤總結,具體問題具體分析:
1、沒有配置偽靜態
默認情況下,偽靜態的設置為html,如果我們設置偽靜態後綴為空

‘URL_HTML_SUFFIX‘=>‘‘

多個偽靜態後綴設置 用|分割

‘URL_HTML_SUFFIX‘ => ‘html|shtml|xml‘

2、偽靜態還需要配合路由設置,配置nginx.conf

location / {

index index.html index.htm index.php;
if (!-e $request_filename) { 
    rewrite ^/index.php(.*)$ /index.php?s=$1 last;  #必須在前面
    rewrite ^(.*)$ /index.php?s=$1 last;
    break;
}

}

配置.htaccess是:

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

</IfModule>

3、runtime文件夾的寫權限沒有開啟!註意查看

thinkphp部署服務器後出現404錯誤