Set Expires Headers in .htaccess

Set Expires Headers in .htaccess to speed up page load times

If you use the firebug pagespeed addon or yslow you will be used to seeing the warning 'Add Expires Headers'

This can be quite simple to fix by adding the following lines at the bottom of your .htaccess file.

 

 

<IfModule mod_expires.c>
ExpiresActive On
############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires
<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 1 year"
</FilesMatch>
</IfModule>

 

 

This requires the mod_expires extension on your linux server (usually enabled on most shared hosting)

Another good speed tip is to add leverage browser caching

and load mootools directly from google

and Stopping mootools from loading

and gzip files through .htaccess