美文网首页
thinkphp部署服务器后出现404错误

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

作者: Albert新荣 | 来源:发表于2019-08-10 16:03 被阅读0次

关于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错误

      本文链接:https://www.haomeiwen.com/subject/ciprjctx.html