Saturday, August 27, 2011

Leverage browser caching - Apache optimization

Leverage browser caching. Specify an expiration at least one week in the future. Apache optimization.

$ sudo cp /etc/apache2/mods-available/headers.load /etc/apache2/mods-enabled/

# Add to /etc/apache2/sites-enabled/000-default or apache2.conf :
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>

$ sudo /etc/init.d/apache2 restart

No comments: