Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

share|improve this question
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 '12 at 12:01
Aha, CTRL+R works. – CaptainCodeman Mar 3 '12 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? – CaptainCodeman Mar 3 '12 at 12:07
What kind of http response headers are you returning on requests to your home page? – mahnsc Mar 3 '12 at 13:24
mahnsc: None that I know of. Is that what the problem is? – CaptainCodeman Mar 3 '12 at 14:41

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.

share|improve this answer

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.

share|improve this answer

Your Answer


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.