How to disable page cache [duplicate]

0

I have a page that saves the user's photo, when editing the photo the cache always continues taking the old photo to display. Already tried using: and I tried to use some variations of it and it does not work. Does anyone know any other way?

    
asked by anonymous 27.04.2018 / 16:58

1 answer

0

There is a very simple way to circumvent the browsers cache, if you change the image name the browser will "think" that it is a new image and does not assume the cache of the old one.

Another option is in the file .htaccess add this rule

<FilesMatch "\.(gif|ico|jpe|jpeg|jpg|js|png)$">
    <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 "Mon, 10 Apr 1972 00:00:00 GMT"
    </IfModule>
</FilesMatch>
    
27.04.2018 / 17:18