#
# Make sure that all needed Apache modules are loaded
#
<IfModule !deflate_module>
    # DeflateBufferSize / DeflateCompressionLevel / DeflateFilterNote
    # DeflateMemLevel / DeflateWindowSize
    LoadModule deflate_module modules/mod_deflate.so
</IfModule>
<IfModule !setenvif_module>
    # BrowserMatch / BrowserMatchNoCase / SetEnvIf / SetEnvIfNoCase
    LoadModule setenvif_module modules/mod_setenvif.so
</IfModule>
<IfModule !expires_module>
    # ExpiresActive / ExpiresByType / ExpiresDefault
    LoadModule expires_module modules/mod_expires.so
</IfModule>
<IfModule !headers_module>
    # Header / RequestHeader
    LoadModule headers_module modules/mod_headers.so
</IfModule>


#
# Globally activate defalate filter (compression) for reasonable mime types only
#
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml application/javascript

# Lowest is 1, highest is 9
DeflateCompressionLevel 9

# Skip browsers with known problems
# - Netscape Navigator 4.x
# - MS Internet Explorer 4.0 and up
# - a lot of other 3rd party browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# Allow compression for MSIE 7 and 8 (they are still based on "Mozilla/4")
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html


#
# Force caching of scripts, style sheets and images to improve
# performance of displaying the web pages (less network requests)
#
ExpiresActive On

# Expire accessed images after approx. one month in the client's cache
ExpiresByType image/gif  A2592000
ExpiresByType image/png  A2592000
ExpiresByType image/jpg  A2592000
ExpiresByType image/jpeg A2592000

# Expire accessed CSS files after approx. one week in the client's cache
ExpiresByType text/css A605000

# Expire accessed JS files after approx. one week in the client's cache
ExpiresByType application/javascript A605000


#
# Disable Etags
# performance of displaying the web pages (less network requests)
#
Header unset ETag
FileETag None
