0

I'm a rails developer doing some patchwork on a cakephp project.

I pulled from a repository and am trying to get a local version of the project up and running.

Right now, the application is trying to load assets from 'localhost/static/css'

The css is actually located in localhost/app-name/app/webroot/static/css.

I've renamed all the htaccess files (app-name/.htaccess, app/.htaccess, app/webroot/.htaccess) and commented them out, but the app is still looking for my assets at 'localhost/static/'.

What am I missing?

Thanks

3 Answers 3

2

You need the .htaccess files!

Do you have mod_rewrite installed and enabled?

Do you have allow_override All set for your application webroot in you apache config? (So apache will read the CakePHP .htaccess files)

Did you clear the cache? (Remove all the files, but leave the directories in place in app/tmp - and make sure app/tmp is readable/writable by the webserver

Are you missing a symbolic link? I store my assets outside of webroot and symbolically link the directories (css, js, img, etc.) to /app/webroot

Sign up to request clarification or add additional context in comments.

Comments

2

Don't remove .htaccess files. As in mine case I was facing same problem and now it's working fine.

Trick is simple, just ho to Apache directory, and open httpd.conf and search for rewrite_module and remove comment(#) from that line i.e.
#LoadModule rewrite_module modules/mod_rewrite.so will be
LoadModule rewrite_module modules/mod_rewrite.so

Comments

1

First you don't have to delete .htaccess and be sure that mod_rewrite is enabled into your localhost.
Second In cakephp there is a great helper called Html If you want to load a js try this into your view:

echo $this->Html->script('your_js.js');

this js have to be into your app/webroot/js

Instead for css try to use:

echo $this->Html->css('your_css.css');

Css have to be in this folder: app/webroot/css

cakephp have already its path but you have to respect convention

2 Comments

I enabled mod_rewrite but the app is still looking for assets in "localhost/static/". Any other ideas?
please add to your question the file routes in config and an example of your incorrect path @Squadrons

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.