T
T
time_is_always_against_us2017-10-24 04:18:23
PHP
time_is_always_against_us, 2017-10-24 04:18:23

How to make the browser not forget the cached images from the site?

Now it turns out like this: the browser saves pictures (and other statics, like js) for ~ 5-10 minutes. and then if you reload the page, it will start loading them again. A similar effect occurs if you close the browser and open the site again.
But at the same time:
- There is a local version of the site - everything is fine on it.
- If the old server is on Centos 5, everything was fine on it too.
- There is a new server on Centos 7 (the site went there a couple of days ago, the code and the database are completely identical) - it is there that such an effect is observed, apparently it misconfigured something, which was previously installed automatically.
- The server has ISPmanager, PhpMyAdmin, and they don't seem to have such problems, which is quite strange.
I myself didn’t do anything about the cache, except that in search of a solution to the problem I tried to force caching in htaccess, but it didn’t work. Added this:

<ifModule mod_headers.c>
  <FilesMatch "\.(html|htm)$">
    Header set Cache-Control "max-age=43200"
  </FilesMatch>
  <FilesMatch "\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|wav|avi|zip|gz|rar|swf|ttf)$">
    Header set Cache-Control "max-age=2592000"
  </FilesMatch>
  <FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
    Header unset Cache-Control
  </FilesMatch>
</IfModule>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2017-10-24
@Stalker_RED

Take some "problem" picture and compare the headers that give out the old and new servers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question