FREE THOUGHT · FREE SOFTWARE · FREE WORLD

Speed Tips: Add Future Expires Headers

With Expires HeaderA 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.

Add Future Expires Headers

Keep in mind, if you use a far future Expires header you have to change the component's filename whenever the file changes.

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.


Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"

Without Expires Headers

No Expires Headers

With Expires Headers

With Expires Header

Htaccess Expires FilesMatch Header Htaccess

 

 

Comments