Leverage Browser Caching

Configure web server settings to leverage browser caching for improved website performance.

Code

## LEVERAGE BROWSER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/gif "access 1 week"
ExpiresByType image/png "access 1 week"
ExpiresDefault "access 7 days"
</IfModule>

## Fonts caching for a year
<FilesMatch ".(eot|svg|ttf|woff)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>

## Cache Icon, PDF and Flash movie for a year
<FilesMatch ".(ico|pdf|flv|swf)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>

## Cache CSS and JS for 1 week
<FilesMatch ".(xml|txt|css|js)$">
Header set Cache-Control "max-age=604800, proxy-revalidate"
</FilesMatch>

## LEVERAGE BROWSER CACHING ##