# Compress output to make pages smaller
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/atom_xml
  AddOutputFilterByType DEFLATE application/x-javascript

  BrowserMatch             ^Mozilla/4 gzip-only-text/html
  BrowserMatch             ^Mozilla/4\.0[678] no-gzip
  BrowserMatch             \bMSIE !no-gzip !gzip-only-text/html

  <IfModule mod_headers.c>
    Header append Vary User-Agent env=!dont-vary
  </IfModule>
</IfModule>


# Remove ETag Headers
<IfModule mod_headers.c>
  Header unset ETag
  FileETag None
</IfModule>

# Set Cache-Control, but only if not already set!
SetEnvIf !Cache-Control value NO_CACHE_CONTROL

<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf|pdf|flv|mp3)$">
  <IfModule mod_header.c>
    Header set Cache-Control "public" env=NO_CACHE_CONTROL
  </IfModule>
</FilesMatch>

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "now"

  # Media files
  ExpiresByType image/gif "access plus 1 week"
  ExpiresByType image/png "access plus 1 week"
  ExpiresByType image/jpg "access plus 1 week"
  ExpiresByType image/jpeg "access plus 1 week"
  ExpiresByType video/ogg "access plus 1 week"
  ExpiresByType audio/ogg "access plus 1 week"
  ExpiresByType video/mp4 "access plus 1 week"
  ExpiresByType video/webm "access plus 1 week"
  ExpiresByType image/x-icon "access plus 1 week"

  # Fonts
  ExpiresByType application/x-font-ttf "access plus 1 week"
  ExpiresByType font/opentype "access plus 1 week"
  ExpiresByType application/x-font-woff "access plus 1 week"
  ExpiresByType image/svg+xml "access plus 1 week"
  ExpiresByType application/vnd.ms-fontobject "access plus 1 week"

  # Static assets
  ExpiresByType text/css "access plus 1 week"
  ExpiresByType application/javascript "access plus 1 week"
  ExpiresByType text/javascript "access plus 1 week"

  # Feeds can be cached, but not too long
  ExpiresByType application/rss+xml "access plus 1 hour"
  ExpiresByType application/atom+xml "access plus 1 hour"
</IfModule>

