简体   繁体   English

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

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

I set up GZIP Compression, it's working for css/js files, but not for html page. 我设置了GZIP压缩,它适用于css / js文件,但不适用于html页面。

Please help me troubleshoot. 请帮助我进行故障排除。

Server have compression enabled, here are info.php stats related to compression: 服务器已启用压缩,以下是与压缩相关的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 

Here are the .htacess part: 这是.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 

It is compressing css and js. 它正在压缩CSS和JS。 Initially on google page insights test all css, js and page itself were showed as not compressed, now only page itself. 最初,在google页面洞察力测试中,所有css,js和页面本身均显示为未压缩,现在仅页面本身。 Also here is the screenshot from firefox web developers tool. 这也是firefox Web开发人员工具的屏幕截图

What can be a problem? 有什么问题吗? I am using magento ver 1.9 if it makes difference. 我使用的是magento ver 1.9(如果有所作为)。

For anybody with same question the problem was that hosting provider didn't enable " zlib.output_compression " 对于任何有相同问题的人,问题在于托管服务提供商未启用“ zlib.output_compression

After enabling it the issue is solved. 启用它后,问题就解决了。

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

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