Search code examples
phpcachingbrowser-cachecache-control

Site requires ctrl f5 to load


I am working on a PHP site. All the pages are being cached by the browser so when something changes I keep having to pressing CTRL + F5 to get the latest version of the page. The issue happens in Firefox, Chrome and IE. The site is pretty old and uses query strings a lot for navigation.

I have tried using the following Meta tags as suggested in the answer below, however nothing appears to be stopping the browser caching the page.

https://stackoverflow.com/a/1341133/310098


Solution

  • Most of the time it is a good thing that the browser is caching the page and it's assets like JS, CSS, etc. This will lighten the load on your server, so don't turn it off lightly!

    If you have an application that requires the cache to be turned off, you can use the HTTP headers mentioned in this article:

    http://www.paulund.co.uk/disable-http-cache-with-php