1

I am new in cakephp (using 2.8.0 verison),I uploaded backup of site then index page showing without css and js. After press "ctrl + U " , Showing missing "Js controller" and "Css controller" not found

Here is my code in .htaccess file in webroot folder

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

Is there any other way for fix this ? How can i fix this issue.

  • How about add read permissions to css, js, img, tmp, logs folders? and read https://book.cakephp.org/3.0/en/installation.html ? – Salines Dec 13 '18 at 16:21

1 Answers1

1

Following could work implied your css and js have its own subfolder (not tested)

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !^/css
    RewriteCond %{REQUEST_URI} !^/js
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

see https://serverfault.com/questions/410445/excluding-a-directory-from-a-root-htaccess-rewrite-rule-to-allow-it-to-be-passw

J. Knabenschuh
  • 747
  • 4
  • 15
  • i replace your code with .htaccess in webroot folder but its not working – Priya Jaiswal Dec 13 '18 at 08:42
  • Do you have your css and js in ${webroot}/css and ${webroot}/js? Otherwise try to remove the slash `RewriteCond %{REQUEST_URI} !^css` and `RewriteCond %{REQUEST_URI} !^js` – J. Knabenschuh Dec 13 '18 at 08:52