How to send compressed (deflated) SVG via Apache2?

前端 未结 5 531
夕颜
夕颜 2020-12-04 21:49

I have specified the following attributes in my site\'s .htaccess file:

AddOutputFilterByType DEFLATE image/svg+xml
DeflateCompressionLevel 9
He         


        
5条回答
  •  暖寄归人
    2020-12-04 22:31

    If Apache doesn't know the mime type of the file (here image/svg+xml), you need to tell it specifically (not needed in most Apaches):

    AddType image/svg+xml svg svgz
    

    Now when Apache knows about the filetype, just add this to deflate it:

    AddOutputFilterByType DEFLATE image/svg+xml
    

    For more information see https://httpd.apache.org/docs/2.4/mod/mod_deflate.html

提交回复
热议问题