4

I don't get why my .svg files are not compressed by deflate or gzip though I have enabled it in the .htaccess. The rest (should) be compressed normal - I was watching HTML, JS, and CSS files.

Here is what I have in my .htaccess

<IfModule mod_mime.c>
    # Make SVGZ fonts work on the iPad.
    # https://twitter.com/FontSquirrel/status/14855840545
    AddType     image/svg+xml                           svg svgz
    AddEncoding gzip                                    svgz
</IfModule>

<IfModule mod_deflate.c>

    # Force compression for mangled headers.
    # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
    <IfModule mod_setenvif.c>
        <IfModule mod_headers.c>
            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
            RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
        </IfModule>
    </IfModule>

    # Compress all output labeled with one of the following MIME-types
    # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
    #  and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
    #  as `AddOutputFilterByType` is still in the core directives).
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE application/atom+xml \
                                      application/javascript \
                                      application/json \
                                      application/ld+json \
                                      application/rss+xml \
                                      application/vnd.ms-fontobject \
                                      application/x-font-ttf \
                                      application/x-web-app-manifest+json \
                                      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>

And yes, zlib.compression~ is set to On and the level is 9 (feedback on the level is also appreciated ;)

Thanks for reading and have a nice day! :)

Thomas Venturini
  • 3,500
  • 4
  • 34
  • 43
  • Similar question: http://stackoverflow.com/questions/21356811/how-to-send-compressed-deflated-svg-via-apache2. Any of the answers there work for you? – Erik Dahlström Apr 01 '14 at 07:49
  • this project is no longer actual, sry. but if i encounter this problem again I will pick up your link. Thanks! :) – Thomas Venturini Aug 01 '14 at 18:04

0 Answers0