Apache mod_deflate does not decompress .svg files

Created:

2016-12-18 06:44:29 UTC

Modified:

2017-08-08 13:21:04 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Apache mod_deflate does not decompress .svg files

Applicable to:

  • Plesk 12.5 for Linux

Symptoms

  • Unable to activate deflate compression for .svg vector graphics.
  • Compression works without issue for any other file type.
  • The following lines are presented in /var/www/vhosts/example.com/httpdocs/.htaccess :

    <IfModule mod_deflate.c>
    ...
    AddOutputFilterByType DEFLATE image/svg+xml
    </IfModule>
  • .htaccess file with configuration is present for this domain.

Cause

Misconfiguration of the .htaccess file. It contains the line below:

    SetEnvIfNoCase REQUEST_URI \\.(?:gif|jpg|jpeg|png|svg)$ no-gzip dont-vary

Resolution

Remove svg from the list:

    SetEnvIfNoCase REQUEST_URI \\.(?:gif|jpg|jpeg|png)$ no-gzip dont-vary

Additional information

The following website can be used to check if a website/page/file is gzipped: http://www.whatsmyip.org/http-compression-test/

Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    Adam Kijak

    And if we're not using a .htaccess file, where is the line to remove 'svg' from?

  • 0
    Avatar
    Robert Asilbekov

    @Adam Kijak if you are no using .htaccess, then you should look for `mod_deflate` directives in apache config files or just add into .htaccess file

     

    <IfModule mod_deflate.c>

    SetEnvIfNoCase REQUEST_URI \\.(?:gif|jpg|jpeg|png)$ no-gzip dont-vary

    AddOutputFilterByType DEFLATE image/svg+xml

    </IfModule>

Please sign in to leave a comment.