Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cakephp css not loading

Tags:

css

cakephp

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!

like image 336
flint Avatar asked Aug 07 '26 01:08

flint


2 Answers

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

like image 65
Nezir Avatar answered Aug 08 '26 14:08

Nezir


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.

like image 42
AD7six Avatar answered Aug 08 '26 14:08

AD7six



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!