must-revalidate
header to force checking the ETag
and or Last-Modified
for the file to make sure the cache is using the current version.
Keep in mind, if you use a far future Expires header you have to change the component's filename whenever the file changes. So please add must-revalidate to your Cache-Control header for your .html files.
This goes in your root .htaccess file but if you have access to httpd.conf
that is better.
This code uses the FilesMatch directive and the Header directive to add Cache-Control Headers to certain files.
# 480 weeks Header set Cache-Control "max-age=290304000, public" # 2 DAYS Header set Cache-Control "max-age=172800, public, must-revalidate" # 2 HOURS Header set Cache-Control "max-age=7200, must-revalidate"
If you are using far Future Expires Headers and Cache-Control (recommended), you can do this for these files.
Header set Cache-Control "public" Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
You can use the HTTP Header Viewer Tool to check it.
Header unset Pragma FileETag None Header unset ETag # 1 YEAR Header set Cache-Control "public" Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT" Header unset Last-Modified # 2 HOURS Header set Cache-Control "max-age=7200, must-revalidate" # CACHED FOREVER # MOD_REWRITE TO RENAME EVERY CHANGE Header set Cache-Control "public" Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT" Header unset Last-Modified