flint
flint

Reputation: 345

cakephp css not loading

I edited my cake.generic.css file and since then css doesn't work at all. Everything else on the site works, but cakephp says on the site's index that "URL rewriting is not properly configured on your server. 1) Help me configure it 2) I don't / can't use URL rewriting."

My .htaccess files are exactly like explained here: .htaccess for cakephp.

All the text on the site is white against a white background. I can access my css file at http://domain.com/css/cake.generic.css.

Any thoughts? I can provide more info if you will just tell me what you need. Thanks for your help!

Upvotes: 3

Views: 9567

Answers (2)

Nezir
Nezir

Reputation: 6925

I fixed issue by uncommenting this line in app/core.php Configure::write('App.baseUrl', env('SCRIPT_NAME'));

Upvotes: 3

AD7six
AD7six

Reputation: 66378

There is no mod rewrite problem

Everything else on the site works

The default home page contains the following:

<p id="url-rewriting-warning" style="background-color:#e32; color:#fff;">
    <?php echo __d('cake_dev', 'URL rewriting is not properly configured on your server.'); ?>
    1) <a target="_blank" href="http://book.cakephp.org/2.0/en/installation/url-rewriting.html" style="color:#fff;">Help me configure it</a>
    2) <a target="_blank" href="http://book.cakephp.org/2.0/en/development/configuration.html#cakephp-core-configuration" style="color:#fff;">I don't / can't use URL rewriting</a>
</p>

The important point there - is that it has inline styles and an id.

Of relevance, the css file contains the following rule:

#url-rewriting-warning {
    display:none;
}

I.e. it's always present and hidden by css.

If the cake.generic.css file has been edited removing that rule, the mod rewrite warning will be shown even though mod rewrite works fine.

The css file has been edited

I edited my cake.generic.css file and since then css doesn't work at all

It's not a good idea to edit cake.generic.css. Restore to the original state, create a css file for your own rules, e.g. webroot/css/styles.css, put css rules in it and link to it in the layout:

echo $this->Html->css('cake.generic.css');
echo $this->Html->css('styles');

i.e. add to/overwrite the generic styles (if they are needed at all), don't edit them directly.

Upvotes: 1

Related Questions