Whenever I update my website by uploading a new index.html or index.php, it always takes a long time (e.g. hours or days) for that change to propagate to my browser.

Even when I hit F5, I still get the old page loaded (quite fast too), so I'm guessing that it's being cached somewhere.

The problem happens in Firefox and Chrome.

Currently I get around this by using a different access URL every time (e.g. every time I make a change, I enter my URL as www.example.com/?a=43784 with a different random number every time.)

What's the correct solution to this problem? (For example, I can't imagine a news website would be very useful if people's computers/browsers cached the results for hours/days)

  • 2
    Probably your browser settings. I always turn off all caching in at least a single browser on my system, just to avoid these issues. Did you try a hard refresh, CTRL+R or CTRL+F5 ?
    – pritaeas
    Mar 3, 2012 at 12:01
  • Aha, CTRL+R works. Mar 3, 2012 at 12:06
  • But I can't tell the users to press CTRL+R, how can I make sure users are always seeing the latest version of the website? Mar 3, 2012 at 12:07
  • 1
    What kind of http response headers are you returning on requests to your home page?
    – mahnsc
    Mar 3, 2012 at 13:24
  • mahnsc: None that I know of. Is that what the problem is? Mar 3, 2012 at 14:41

3 Answers 3


Probably your website is too optimized for speed. If your server uses Apache you can change the default config by adding an .htaccess file with the configuration that works for you.

There are many web pages on the Internet that can help you on this task, like for example: http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html

Please note that some Apache servers have the .htaccess file disabled, and in that case it will not work.


If you're using chrome I like to switch to developer mode and then hold down the reload button next to the URL bar and it will present you with a few different options for reloading the page.

enter image description here


Cache-Control and Expires headers can be used to indicate that specific elements need to be cached for longer or shorter periods.

Typically, you want images and other objects to have a far-future expiration for network efficiency and more dynamic content to have shorter expiration or no caching at all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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