2

My css file is not loading.

I have just installed apache2 with php on ubuntu. (Mysql server already installed.)

I have placed fresh download of cake php from official site. But when I am trying to access it, CSS file is not loaded.

Here is the screen shot.

alt text

1
  • do you have mod_rewrite enabled? Commented Jan 19, 2011 at 20:31

4 Answers 4

4

I would think telling him to read the instructions and setup requirements including the use of mod_rewrite would be a better solution than pointing him towards the no mod_rewrite method.

A quick google for mod_rewrite apache ubuntu brings up a ton of possibly useful information and will likely work out for him better than turning off one of Cake's key features.

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

2 Comments

Maybe so, I assumed that in a developing environment pretty URLs weren't all that important. What he wanted was to get his css loading, so I gave him information on doing that, the quickest way I knew how. Maybe it wasn't the best way, if he was asking about a production install, I probably would have given him both alternatives. As I said, I didn't think it using mod_rewrite was so necessary in a development environment, if later he wanted to enable it, he just needs to paste four files and comment one line in the config. Anyway, I'll keep what you said in mind if anyone asks again about this
Don't get me wrong - your answer was correct and good - I just think in 2 weeks when he can't get routing working or goes into production etc that he will just have to ask a slightly different question for us to answer again. Especially since it should be as simple for him as uncommenting the mod_rewrite.so reference in his apache config.
3

Try deleting these files:

 /.htaccess
 /app/.htaccess
 /app/webroot/.htaccess

and uncommenting this line on app/config/core.php [69]

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

EDIT:

to answer your comment: as far as I know, what this does is set the base url of the app to index.php (env() Gets an environment variable from available sources) That baseUrl is used to rewrite the urls without using mod_rewitte, with pathinfo.

2 Comments

cool.. worked.. can u explain me the line u uncommented. I am just new to cakephp. Worked on php last year and working on rails.
doing this means that you will not have 'seo urls' instead have index.php/... you should have just done sudo a2enmod rewrite or something similar
0

I've seen this issue when the .htaccess is missing from the root or from webroot. Usually, this occurs when adding files to svn and the .htaccess is not included.

Comments

0

Just wanted to add

to enable mod_rewrite with apache on ubuntu

sudo a2enmod rewrite

Comments

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.