[ACCEPTED]-How to disable Apache gzip compression for some media files in .htaccess file?-apache2

Accepted answer
Score: 10

I had to disable compression for odp files 3 for use by external plugin Just added the 2 following rule in .htaccess file

SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.odp$ no-gzip dont-vary

And the 1 server disabled compression for odp files Make sure to clear the browser cache before testing

Score: 4

Are you not going about this the wrong way 9 round by using the directive SetOutputFilter DEFLATE and then trying 8 to disable this for stream which already 7 include some form of compresstion? Isn't 6 it a lot easier not to use this directive and 5 then compress the stream that are compressible. E.g.

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript application/javascript application/ecmascript application/rss+xml
</IfModule>

And 4 possibly adding a Vary header:

<IfModule mod_headers.c>
    <FilesMatch "\.(js|css|xml|html)$">
        Header append Vary Accept-Encoding
    </FilesMatch>
</IfModule>

OK this may 3 miss the odd type that you've not thought 2 of, but it will achieve 99+% of your compression 1 potential.

Score: 1

To disable gzip compression on just Adobe 4 Flash Player files (SWFs) on my Apache server, I 3 added this to my .htaccess file:

<IfModule mod_headers.c>
    <FilesMatch "\.swf$">
        RewriteRule ^(.*)$ $1 [NS,E=no-gzip:1,E=dont-vary:1]
    </FilesMatch>
</IfModule>

If you wanted 2 to, you could disable gzip compression for 1 other file types as well:

<IfModule mod_headers.c>
    <FilesMatch "\.(js|css|swf)$">
        RewriteRule ^(.*)$ $1 [NS,E=no-gzip:1,E=dont-vary:1]
    </FilesMatch>
</IfModule>
Score: 0

I think you are not using compression in 6 your media. Did you check that you are in 5 fact deflating files? The module can be 4 loaded in memory, but that doesn't mean 3 it's compressing files. If your .htaccess 2 only has rewrite rules chances are you are 1 not compressing any kind of content.

Score: 0

this seems outdated : https://www.varnish-cache.org/docs/3.0/tutorial/compression.html#gzip-and-esi

GZIP and ESI

If you are using Edge 5 Side Includes you'll be happy to note that 4 ESI and GZIP work together really well. Varnish 3 will magically decompress the content 2 to do the ESI-processing, then recompress 1 it for efficient storage and delivery.

More Related questions