Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

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'
share|improve this answer
    
I figured it was a local problem, because some of the other users are getting the updated files, but I had to check to make sure that I was doing my best on my side. Thanks for the response. –  kabuto178 Mar 10 '13 at 22:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.