What I’m trying to do?
I have an admin page where I can change images – they all use fixed names, and are uploaded directly to the file system, but sometimes when I upload it just displays an old image.
At the same time I don’t want to download the pages over and over again, as it will be just slow and ugly.
So what I want is to make no cache for the actual output text in my php, but for the images to make it revalidate the creation date, and if it’s more recent than stored in cache to download a new one, otherwise to load it from cache.
Please advice what headers I would best use for that purpose, or if it’s impossible to make it that way..
Thanks 🙂
An easy way to do this is to append a query string to the end of the image file name and changing it each time the image changes. The query string is ignored by the image file so it won’t affect it at all but to the browser it is part of the image name so when it changes it forces the browser to get the new image.
For example, you can call an image
someimage.png?1. When the image is updated you then would call itsomeimage.png?2.