CakePHP 2.6.0不加载CSS和JS文件 [英] CakePHP 2.6.0 is not loading CSS and JS files

查看:662
本文介绍了CakePHP 2.6.0不加载CSS和JS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将我的网站上传到服务器,但没有加载css和js文件,只有我可以看到的网站就像文本,后把.htaccess文件在他们的地方我在网站上收到此消息:

I just uploaded my website to the server but is not loading the css and js files, only I can see the site just like text and after put the .htaccess files in their places I got this message in the site:


内部伺服器错误

Internal Server Error

伺服器遇到内部错误或配置错误,无法完成您的请求。

The server encountered an internal error or misconfiguration and was unable to complete your request.

请与服务器管理员联系,告知他们错误发生的时间,以及您可能做的任何事情可能会导致错误。

Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

有关此错误的详细信息可在服务器错误日志中找到。

More information about this error may be available in the server error log.

此外,在尝试使用ErrorDocument处理请求时遇到500个内部服务器错误错误。

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

这些是我的.htaccess文件

These are my .htaccess files

/ www /

 <IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

/ www / app /

/www/app/

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule    ^$    webroot/    [L]
RewriteRule    (.*) webroot/$1    [L]

/ www / app / webroot /

/www/app/webroot/

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

有些想法为什么不工作?我希望你能帮助我,谢谢。

some idea why is not working? I hope you can help me, thank you.

<?php

    echo $this->Html->css('bootstrap');
    echo $this->Html->css('styles');

    echo $this->Html->script('jquery');
    echo $this->Html->script('bootstrap.min');

    echo $this->fetch('meta');
    echo $this->fetch('css');
    echo $this->fetch('script');

?>


推荐答案

我解决了我的问题,我的case)删除三个.htaccess文件,并编辑这行在app / config / core.php

I solved my problem, the solution is firstly (in my case) delete the three .htaccess files and edit this line in app/config/core.php

//Configure::write('App.baseUrl', env('SCRIPT_NAME'));

Configure::write('App.baseUrl', env('SCRIPT_NAME'));

它适用于我,谢谢你们。

it works for me, thanks guys anyway.

这篇关于CakePHP 2.6.0不加载CSS和JS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆