Disable caching in Apache2

Published: Wednesday, Dec 26, 2007 Last modified: Thursday, Nov 14, 2024

You need to enable the mod_headers extension: http://httpd.apache.org/docs/2.2/mod/mod_headers.html On a Debian system:

sudo a2enmod headers

Throw this into a .htaccess

Header set Expires "Thu, 19 Nov 1981 08:52:00 GM"
Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
Header set Pragma "no-cache"