Jquery CPanel托管的Symfony网站仅显示HTML,无法加载CSS和JS文件
我们尝试在Cpanel上上传一个Symfony5网站,该网站只显示HTML部分,但是CSS和JS似乎没有加载。它表示“net::ERR_中止404(未找到)”或“加载资源失败:服务器响应状态为404(未找到)”。我们有两个.htaccess文件,一个在项目文件夹的根目录上,另一个在公用文件夹中,公用html文件夹中的index.php如下所示: Index.php:Jquery CPanel托管的Symfony网站仅显示HTML,无法加载CSS和JS文件,jquery,css,load,cpanel,symfony5,Jquery,Css,Load,Cpanel,Symfony5,我们尝试在Cpanel上上传一个Symfony5网站,该网站只显示HTML部分,但是CSS和JS似乎没有加载。它表示“net::ERR_中止404(未找到)”或“加载资源失败:服务器响应状态为404(未找到)”。我们有两个.htaccess文件,一个在项目文件夹的根目录上,另一个在公用文件夹中,公用html文件夹中的index.php如下所示: Index.php: include dirname(__FILE__).'/<ProjectFileName>/public/index.
include dirname(__FILE__).'/<ProjectFileName>/public/index.php';
<code>
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$/public/$1 [L]
</IfModule>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
RewriteRule .* - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .+
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
</IfModule>
</IfModule>
include dirname(_文件__)。“//public/index.php”;
.htaccess在项目根目录中找到:
include dirname(__FILE__).'/<ProjectFileName>/public/index.php';
<code>
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$/public/$1 [L]
</IfModule>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
RewriteRule .* - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .+
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
</IfModule>
</IfModule>
选项-多视图
重新启动发动机
重写cond%{REQUEST_URI}^/公开的/
重写规则^(.*)$/public/$1[L]
.htaccess在公用文件夹中找到:
include dirname(__FILE__).'/<ProjectFileName>/public/index.php';
<code>
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$/public/$1 [L]
</IfModule>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
RewriteRule .* - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .+
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
RewriteCond %{ENV:REDIRECT_STATUS} =""
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
</IfModule>
</IfModule>
选项-多视图
重新启动发动机
RewriteCond%{REQUEST_URI}:$0^(/.+)/(.*):\2$
重写规则。*-[E=基:%1]
RewriteCond%{HTTP:Authorization}+
重写规则^-[E=HTTP\U授权:%0]
RewriteCond%{ENV:REDIRECT_STATUS}=“”
重写规则^index\.php(?:/(.*)|$)%{ENV:BASE}/$1[R=301,L]
重写cond%{REQUEST_FILENAME}-F
重写规则^%{ENV:BASE}/index.php[L]
链接CSS:
<link rel="stylesheet" type="text/css" href="{{ asset ('css/navbar.css')}}">
脚本JS:
<script src="{{ asset ('js/three.js') }}"></script>
<script src="{{ asset ('app/app_3D_responsive.js') }}"></script>
附言:该网站在localhost:8000上运行良好
有人能帮忙吗
先谢谢你