yan-k
9/26/2017 - 1:23 PM

Leverage Browser Caching

Leverage Browser Caching

## LEVERAGE BROWSER CACHING ##
<IfModule mod_expires.c>
  ExpiresActive On
  
  # Add correct content-type for fonts
  AddType application/vnd.ms-fontobject .eot
  AddType application/x-font-ttf .ttf
  AddType application/x-font-opentype .otf
  AddType application/x-font-woff .woff
  AddType image/svg+xml .svg
  
  # Compress compressible fonts
  AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-opentype image/svg+xml
  
  # Common Types
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/javascript "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType application/x-javascript "access 1 month"
  ExpiresByType application/javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 2 days"
  
  # Add a far future Expires header for fonts
  ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
  ExpiresByType application/x-font-ttf "access plus 1 year"
  ExpiresByType application/x-font-opentype "access plus 1 year"
  ExpiresByType application/x-font-woff "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"

</IfModule>
## LEVERAGE BROWSER CACHING ##

## BEGIN Disable ETag header ##
  Header unset Pragma
  Header unset ETag
  FileETag None
## END Disable ETag header ##

## BEGIN Vary: Accept-Encoding Header ##
  <IfModule mod_headers.c>
    <FilesMatch "\.(js|css|xml|gz)$">
    Header append Vary: Accept-Encoding
    </FilesMatch>
  </IfModule>
## END Vary: Accept-Encoding Header ##