thinkphp部署服务器后出现404错误

关于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文件夹的写权限没有开启!注意查看

猜你喜欢

转载自blog.51cto.com/13238147/2351144