繁体   English   中英

GZIP压缩适用于CSS / JS,但不适用于HTML

[英]GZIP Compression is working for css/js but not for html

我设置了GZIP压缩,它适用于css / js文件,但不适用于html页面。

请帮助我进行故障排除。

服务器已启用压缩,以下是与压缩相关的info.php统计信息:

 _SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate Stream Wrapper compress.zlib:// Stream Filter zlib.inflate, zlib.deflate Compiled Version 1.2.3 Linked Version 1.2.3 

这是.htacess部分:

 # Insert filter on all content SetOutputFilter DEFLATE # Insert filter on selected content types only AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \\bMSIE !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI \\.(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary 

它正在压缩CSS和JS。 最初,在google页面洞察力测试中,所有css,js和页面本身均显示为未压缩,现在仅页面本身。 这也是firefox Web开发人员工具的屏幕截图

有什么问题吗? 我使用的是magento ver 1.9(如果有所作为)。

对于任何有相同问题的人,问题在于托管服务提供商未启用“ zlib.output_compression

启用它后,问题就解决了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM