我的laravel (v5.8)项目在本地主机上运行良好,但在我将其上传到cPanel之后,所有公共html中的图像、css和JS文件都未能在浏览器中加载,并在浏览器控制台中显示错误,如下所示:
“未能加载我们的-parach.png:1资源:服务器响应状态为404 ()”
“加载资源失败: main.css:1服务器响应状态为500 ()”
当框架本身很好地加载并且没有显示错误时。我更新了PHP到7.4,并跟踪了几乎每一个youtube和StackOverflow的线程,但没有任何效果。
index.php修饰:
require __DIR__.'/../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';AppServiceProvider.php改性
public function register()
{
$this -> app -> bind('path.public', function()
{
return base_path('public_html');
});
}My in cPanel :
...
--高速缓存
laravel (没有公用文件夹的项目文件)
.=‘2’>.
.=‘2’>.=‘2’>.
. config =‘config 2’>.config=‘config 3’>.config=‘config 2’>.
/T1393-1988工业用.env
/T1393-1988工业用server.php
.=‘2’>.剩下的文件
--等等
--原木
-邮件
-- public_html
. css =‘css 2’>.=‘css 2’>.=‘css 2’>.
.=‘2’>.=‘2’>.=‘5’>.
2.=‘2’>.=‘5’>.
/T1393-1988工业用.htaccess
/T1393-1988工业用index.php
of /T1593-1988档案的再加工...rest
public_html :中的htaccess文件
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>发布于 2020-07-07 17:36:51
显然问题在文件权限中,我将文件夹设置为755,文件设置为644,一切都很有魅力。
https://stackoverflow.com/questions/62774951
复制相似问题