I need help with tweaking Cache-Control for an xml file so that it forces the client to re-download the file every time there is a change to it. It is an xml files that contains a bunch of google map markers and it gets read by a custom google maps application on page load. The system writes changes to the xml file each time a new listing is created/modified/deleted by an admin.. So how can I make it so the client browser or any part of the cache chain will be forced to download a new copy when the file is changed? (P.S. i want to place this setting in an .htaccess file that sits in the same directory as the xml file)
Hi, you need to add a query string variable at the end of xml file name where you are accessing it....
2.1 should be a random number
Hope it helps!
Thanks you for your feedback and accept.
So that means it'll be cached still? And that it will only need to download again when there is a change to the file?
Until your version number remains same it will remain in the cache. as soon as you will change the version number to say 2.2 or anything, it will force the browser to download the new copy from the browser. Same technique is used if someone wants to make sure that all script files are latest from server and not from cache.
Ok sounds good. And this is the only way to do it?
Developing software since 1999 in different languages and databases.
Thank you for the accept. I am sure there would be other ways as well, however I've used only this one as its easy to deal with.thanks again.