Hail Hydra Hail Hydra - 1 year ago 167
CSS Question

CakePHP 2.6.0 is not loading CSS and JS files

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.

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

These are my .htaccess files


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


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


<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.


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');


Answer Source

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'));

to this:

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

it works for me, thanks guys anyway.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download