From 957e060055e324994439913555509681355096c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C4=83t=C4=83lin=20Mari=C8=99?= Date: Wed, 22 Aug 2012 21:07:07 +0300 Subject: [PATCH] More general compression configuration for Apache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Works with Apache ≥ 2.1 and requires `mod_deflate` and `mod_filter` to be enabled. However, use of Apache < 2.2 is no longer recommended. For Apache ≥ 2.1 → 2.3.7, `mod_filter` isn't needed, but requiring it and using this solution is the best way going forward (plus, it doesn't introduce other dependencies to other modules like, for example, `mod_version`). Fix h5bp/html5-boilerplate#1012 Ref h5bp/html5-boilerplate#1173 --- .htaccess | 48 ++++++++++++++++++------------------------------ 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/.htaccess b/.htaccess index 220c8689..3f59f9a3 100644 --- a/.htaccess +++ b/.htaccess @@ -163,36 +163,24 @@ AddType text/vtt vtt - # HTML, TXT, CSS, JavaScript, JSON, XML, HTC: - - FilterDeclare COMPRESS - FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html - FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css - FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain - FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject - FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml - FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon - FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf - FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype - FilterChain COMPRESS - FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no - - - - # Legacy versions of Apache - AddOutputFilterByType DEFLATE text/html text/plain text/css application/json - AddOutputFilterByType DEFLATE application/javascript - AddOutputFilterByType DEFLATE text/xml application/xml text/x-component - AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml - AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype + # Compress all output labeled with one of the following MIME-types + + AddOutputFilterByType DEFLATE application/atom+xml \ + application/javascript \ + application/json \ + application/rss+xml \ + application/vnd.ms-fontobject \ + application/x-font-ttf \ + application/xhtml+xml \ + application/xml \ + font/opentype \ + image/svg+xml \ + image/x-icon \ + text/css \ + text/html \ + text/plain \ + text/x-component \ + text/xml