How to prevent http file caching in Apache httpd (MAMP)
Tried this? Should work in both .htaccess
, httpd.conf
and in a VirtualHost
(usually placed in httpd-vhosts.conf
if you have included it from your httpd.conf)
<filesMatch "\.(html|htm|js|css)$">
FileETag None
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
</ifModule>
</filesMatch>
100% Prevent Files from being cached
This is similar to how google ads employ the header Cache-Control: private, x-gzip-ok="" > to prevent caching of ads by proxies and clients.
From http://www.askapache.com/htaccess/using-http-headers-with-htaccess.html
And optionally add the extension for the template files you are retrieving if you are using an extension other than .html
for those.
I had the same issue, but I found a good solution here: Stop caching for PHP 5.5.3 in MAMP
Basically find the php.ini file and comment out the OPCache lines. I hope this alternative answer helps others else out as well.
Based on the example here: http://drupal.org/node/550488
The following will probably work in .htaccess
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
<FilesMatch (\.js|\.html)$>
ExpiresActive Off
</FilesMatch>
</IfModule>