Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess gzip/deflate压缩SVG文件不工作:(_.htaccess_Svg_Apache2_Gzip_Deflate - Fatal编程技术网

.htaccess gzip/deflate压缩SVG文件不工作:(

.htaccess gzip/deflate压缩SVG文件不工作:(,.htaccess,svg,apache2,gzip,deflate,.htaccess,Svg,Apache2,Gzip,Deflate,我不明白为什么我的.svg文件没有被deflate或gzip压缩,尽管我在.htaccess中启用了它。其余的(应该)被正常压缩-我在看HTML、JS和CSS文件 以下是我的.htaccess中的内容 <IfModule mod_mime.c> # Make SVGZ fonts work on the iPad. # https://twitter.com/FontSquirrel/status/14855840545 AddType image/s

我不明白为什么我的.svg文件没有被deflate或gzip压缩,尽管我在.htaccess中启用了它。其余的(应该)被正常压缩-我在看HTML、JS和CSS文件

以下是我的.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>

#让SVGZ字体在iPad上工作。
# https://twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml svg svgz
加法编码gzip svgz
#强制压缩损坏的标题。
# http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
SetEnvIfNoCase^((gzip | deflate)\s*,?\s*)+|[X~-]{4,13}$有接受编码
RequestHeader追加接受编码“gzip,deflate”env=HAVE_Accept-Encoding
#压缩使用以下MIME类型之一标记的所有输出
#(对于低于2.3.7的Apache版本,您不需要启用'mod_filter'`
#并且可以删除``和``行
#因为'AddOutputFilterByType'仍在核心指令中)。
AddOutputFilterByType DEFLATE应用程序/atom+xml\
应用程序/javascript\
应用程序/json\
application/ld+json\
application/rss+xml\
应用程序/vnd.ms-fontobject\
应用程序/x-font-ttf\
application/x-web-app-manifest+json\
application/xhtml+xml\
应用程序/xml\
字体/开放式\
image/svg+xml\
图像/x图标\
文本/css\
文本/html\
文本/纯文本\
文本/x组件\
文本/xml
是的,zlib.compression~被设置为开,级别为9(也欢迎对该级别的反馈;)


感谢阅读,祝您度过愉快的一天!:)

类似问题:。这里的答案对你有用吗?sry,这个项目已经不实际了。但如果我再次遇到这个问题,我会拿起你的链接。谢谢!:)