A first-time visitor to your page will make several HTTP requests to download all your sites files, but using the Expires header you make those files cacheable. This avoids unnecessary HTTP requests on subsequent page views. Expires headers should be used on all components including scripts, stylesheets, and Flash components.
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
Keep in mind, if you use a far future Expires header you have to change the component's filename whenever the file changes.
Add Future Expires Headers
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 Future Expires Headers to certain files.
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT" </FilesMatch>
Without Expires Headers
With Expires Headers
September 10th, 2007
« Firefox, Firebug, and yslow are REQUIREDSpeed Tips: Turn Off ETags »
Comments Welcome
- http://www.aqworks.com Christophe
- Pete
- John
- http://x-referat.ro referat
- http://devcha.com Slavi
- Aguitta
- http://www.dukesgames.net/ Duke
- http://rooturaj.com Pattanaik
- http://jeeshenlee.wordpress.com/ JeeShen Lee
- http://models-hq.com miranda
- http://www.aloe-vera.org David H.
- http://www.pc-manden.dk pc-manden
- web design houston
- http://zulutrade-fx.net/ zulu
- henk