1

I have been struggling with this problem when my site loads from cache when I(and the users) load it. I added these meta tags to my html to prevent this:

<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />

But it did not work. Then I added these to the .htaccess file:

<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0
</IfModule>

<FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|mp3|mp4|png|pdf|swf|txt)$">
    <IfModule mod_expires.c>
        ExpiresActive Off
    </IfModule>
    <IfModule mod_headers.c>
        FileETag None
        Header unset ETag
        Header unset Pragma
        Header unset Cache-Control
        Header unset Last-Modified
        Header set Pragma "no-cache"
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
    </IfModule>
</FilesMatch>

It did not work either.

I added a ?Version= with a random number to my links, it won't work either.

I even disabled the website loading from cache in the browser, but it still loads from cache.

What can I do to finally stop the website from loading from the cache? Some browsers display it correctly for me(firefox for example) but Opera, which i use the most won't.

EDIT: It seems like it smashes more versions together. For example i tested it: when I change a text it changes but, some colors for example won't change.

patrick
  • 59
  • 7
  • Your server or web host may be implementing aggressive caching. I had this problem when my host implemented a third party caching service years ago. I had to yell at them until they disabled it. – isherwood Jan 07 '22 at 16:11

1 Answers1

0

You should try looking into the browser's settings. Seems like they're the main reason for your trouble (since some browsers display it correctly and some do not)

Guinevere
  • 49
  • 1
  • 6
  • I even cleared the cache and it won't work idk what more can I do. I checked the site from my phone as well since writing the question, but there it won't display correctly as well.(chrome). – patrick Jan 07 '22 at 16:11
  • You should try looking into [using Devtools or other extensions to load the site without cache](https://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development) – Guinevere Jan 07 '22 at 16:18
  • shift+refresh now fixed it, but the problem won't go away because if I change something I probably will have to do this all the time and I can't tell all the website users to do this at every update I make to the site. – patrick Jan 07 '22 at 16:22
  • 2
    I found this, might be helpful for you. [How do we control web page caching, across all browsers?](https://stackoverflow.com/questions/49547/how-do-we-control-web-page-caching-across-all-browsers) – Guinevere Jan 07 '22 at 16:27
  • Thanks, I hope it works! – patrick Jan 07 '22 at 16:37