If you remove the Last-Modified and ETag header, you will totally eliminate If-Modified-Since and If-None-Match requests and their 304 Not Modified Responses, so a file will stay cached without checking for updates until the Expires header indicates new content is available!
Easy Apache Speed Tips Articles
- Turn On Compression
- Add Future Expires Header
- Add Cache-Control Headers
- Turn Off ETags
- Remove Last-Modified Header
- Use Multiple SubDomains
Please don't turn off ETags and Last-Modified headers for your .html files, leave one of them ON. (I use Last-Modified for .html).
Remove Last-Modified Header
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 remove all Last-Modified Headers from being sent.
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css)$"> Header unset Last-Modified </FilesMatch>
How it Works
By removing both the ETag header and the Last-Modified headers from your static files (images, javascript, css) browsers and caches will not be able to validate the cached version of the file vs. the real version. By also including a Cache-Control header and Expires header, you can specify that certain files be cached for a certain period of time, and you magically (this is a really unique trick I promise) eliminate any validation requests!!
September 10th, 2007
« Speed Tips: Turn Off ETagsSpeed Up Google Analytics with urchin.js »
Comments Welcome
- http://robotterror.com Robot Terror
- http://robotterror.com Robot Terror
- http://barefoot-webdesign.com Spencer
- http://robotterror.com Robot Terror
- Matt
- http://www.webogroup.com/ sunnybear
- http://www.iuggbootsuk.com uggs
- http://www.google.co.uk richard
- http://rooturaj.com Pattanaik
- http://klaubert.bcb.gov.br Klaubert
- http://www.tesco.com/ David Merrilees
- Francesco
- http://candleforex.com CandleForex
- http://stackoverflow.com/users/260080/marco-demaio Marco Demaio
- http://www.artzstudio.com Dave Artz
- Mike Winter