Sometime, css is not loaded

Good evening,

Sometime, when I visit one of the page of my MODx website, the CSS file is not loaded and the page has no structure.

To solve that problem, I go to manager and I clear the cach.

This problem oft come back after a modfication of a page.

Why the css file is affceted and how can solve that issue. The user can not clear the cache, and I can not look at the web site, each day… :slight_smile:

I believe this can happen when people visit your site with http and https.

Make sure that site_url in your <base> tag is uncached (with the !)

<base href="[[!++site_url]]" />

or maybe change the .htaccess-file to rewrite all requests to https.

Is it just the CSS file that is missing, or is part of the markup (like a head chunk) not being rendered at all?

Many, many years ago I had a similar issue on my site and that was caused by category permissions only being set for administrative users. That meant that in certain scenarios categories (and chunks within them) would not be available to front-end users, causing the site to break.

If it’s just the CSS that’s broken, it probably isn’t that and more likely to be what @halftrainedharry mentioned, but it does sound eerily familiar :wink:

Hello, thanks for your replies.
From my browser, I have not this issue, but I reload the page with https and the problem appears. I cleared the cache and the problem disappear.

my base tag is uncleared

<base href="[[!++site_url]]" />

So why should I redirect (from htaccess) from http to https, if, from my side, the problem come “from that direction”?

And why the css file is broken
<link href="[[++site_url]]manager/templates/micro/css/style.css" rel="stylesheet">
Should I use something then [[++site_url]] to load my css file??

The problem is most likely a “mixed content error”. You access your site with https and it tries to load the CSS file with http which creates an error.

Open the console of your browser’s developer tools (F12 or Ctrl + Shift + I) and check the error message.

To fix this, use site_url uncached (with the !) in your <link>-tag for the CSS file as well (or use a relative url).

<link href="[[!++site_url]]manager/templates/micro/css/style.css" rel="stylesheet">
1 Like

Hello, Thanks

I replaced
site_url by manager_url