Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More general compression configuration for Apache

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
  • Loading branch information...
commit 1ec4456c989f781efc184fb779830bdef0c0f54d 1 parent be378d5
@alrra alrra authored necolas committed
Showing with 18 additions and 30 deletions.
  1. +18 −30 apache/.htaccess
View
48 apache/.htaccess
@@ -163,36 +163,24 @@ AddType text/vtt vtt
</IfModule>
</IfModule>
- # HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
- <IfModule filter_module>
- 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
- </IfModule>
-
- <IfModule !mod_filter.c>
- # 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
+ <IfModule mod_filter.c>
+ 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
</IfModule>
</IfModule>
Please sign in to comment.
Something went wrong with that request. Please try again.