Mobile app version of vmapp.org
Login or Join
Sent6035632

: Handling APACHE file caching I have used .htaccess to cache images, css and javascript files on my server for up to a month. My problem is that some users get updates that I made recently

@Sent6035632

Posted in: #Apache #Htaccess

I have used .htaccess to cache images, css and javascript files on my server for up to a month. My problem is that some users get updates that I made recently and all works normally while some user files have not been upgraded to the latest version. For me after changing one of these files and refreshing the page causes the new changes to take effect on my computer but not for some other users. Is there a way to force updating if I made changes to any of these files? Thank you.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sent6035632

1 Comments

Sorted by latest first Latest Oldest Best

 

@Phylliss660

The fact that some users are getting the updates and not others, means that the server is most likely sending the new content, but the 'other' users' browsers are probably caching the content. Which means, there's nothing YOU can do about specifically.

Though you can TRY to send these headers (which may help the browser to not cache the content) (in PHP)

<?php
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
?>


"Is there a way to force updating if I made changes to any of these files?"


You can try using dynamic filenames, such as 'image003_[timestamp].jpg'

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme