CSS JS and images are not loading in project rest all works good

Hi I am new to cakephp and need some help, I have enabled rewritemod on xampp after that I have checked

htaccess of root folder —

RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L]

htaccess inside app folder ----

RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L]

htaccess inside webroot folder----

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L]

I can see only plain html pages without css, js, and images can anyone gone through same issue please help me…

thanks in advance…

What does your code for adding CSS, JS and images look like? What HTML output is being generated by that code? How do the URLs that end up in your HTML compare to what you’re expecting them to be?

And a follow-up question, was your js & css loading before you set your .htaccess rules?

hi zuluru, actually I am new to cake php this project was working good on server but when I downloded and installed on localhost, project is working properly with database but with 404 error css and js files not found and also images are not visible on website. also I don’t know on which cakephp version this project is made.

attached images link

yes jawfin it was working properly on server but when I installed same project on localhost css, js, image are not loded on website, and also I am confused on which cakephp version this project was made, may be it is made inbetween 2.0 - 3.0 cakephp version.

images link

Without knowing if there’s internal redirection I could guess that you have files in the wrong place.

Looking at your Capture3 it’s wanting the css’s in /assets/frontend/css/ & javascript in /assets/frontend/javascript/

Your Capture4 looks like the www / webroot folder, and I can see there is no assets folder. The css & js must be available to the client so their browser can load and apply them.

Hi Jawfin, my root .htaccess file is something like this on server but now my project is on xampp local host so I want to know does any change required in .htaccess file for local host.

Options -Indexes

RewriteEngine on
RewriteBase /
Options -Indexes
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteCond %{REQUEST_URI} !^/.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/[A-F0-9]{32}.txt(?:\ Comodo\ DCV)?$
RewriteRule (.) http://www.domain.com/$1 [L,R=301]
RewriteCond %{REQUEST_URI} !^/.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/[A-F0-9]{32}.txt(?:\ Comodo\ DCV)?$
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{REQUEST_URI} !^/.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/(?:\ Ballot169)?
RewriteCond %{REQUEST_URI} !^/.well-known/pki-validation/[A-F0-9]{32}.txt(?:\ Comodo\ DCV)?$
RewriteRule (.
) app/webroot/$1 [L]

Same problem… all script js file load on localhost window… not loat at ubuntu… all file already give permission 777…now working either…