3

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

/www/

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

/www/app/

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

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

?>
Hail Hydra
  • 472
  • 6
  • 19
  • Could you show the code you have for outputting the CSS/JS in your View templates? – drmonkeyninja May 29 '15 at 20:41
  • @drmonkeyninja that is the code but I think the problem is about the configuration of some files like the .htaccess or something else, I added RewriteBase / to the .htaccess files and the "500 Internal Server Error" dissappeared and now the site is just empty – Hail Hydra May 29 '15 at 20:56
  • You will also need `RewriteBase /webroot` in the .htaccess inside webroot. Also make sure debug mode is enabled in your cake app so you see errors. – ADmad May 30 '15 at 16:16

4 Answers4

5

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.

Hail Hydra
  • 472
  • 6
  • 19
1

Regarding CSS and JS load issue, please verify mod_rewrite is enabled on your server or not.

Mukesh Ram
  • 6,248
  • 4
  • 19
  • 37
Dhaval Rajani
  • 191
  • 1
  • 2
  • 15
  • How i can verify that in the live server? – Hail Hydra May 29 '15 at 20:31
  • upload one test file and write echo phpinfo(); and run that file and find mode_rewrite keyword if its there then your mode_rewrite is on otherwise contact to your hosting provider they will check and if its not on then they on it – Dhaval Rajani May 29 '15 at 21:10
  • No, there is no the keyword "mode_rewrite" or something related with it – Hail Hydra May 29 '15 at 21:52
  • You can see here www.genebi.net – Hail Hydra May 29 '15 at 22:27
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Necreaux May 30 '15 at 02:43
  • contact your website hosting provider and tell them on mode_rewrite on your server and then check. @necreaux what a problem with few sentence i can solve problem – Dhaval Rajani May 30 '15 at 03:43
1

I'm guessing that none of your 'clean' urls are working, not just your CSS/JS files. So firstly, check that mod_rewrite is enabled on the server. You can do this by checking it's listed as one of the enabled modules using phpinfo().

If it is enabled you probably want to check that your virtual host is configured correctly. You should have AllowOverride All in your vhost's conf file, something like this:-

<VirtualHost *:80>
    ...
    <Directory "/var/www/vhosts/example.com">
        AllowOverride All
    </Directory>
</VirtualHost>
drmonkeyninja
  • 8,490
  • 4
  • 31
  • 59
0

Please delete all the .htaccess file and enable the :

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

in app/config/core.php. its working fine.