【问题标题】:GZIP Compression is working for css/js but not for htmlGZIP 压缩适用于 css/js 但不适用于 html
【发布时间】:2017-05-10 11:47:34
【问题描述】:

我设置了 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。最初在谷歌页面洞察测试中,所有 css、js 和页面本身都显示为未压缩,现在只有页面本身。 这里还有来自 firefox web 开发者工具的screenshot。

可能是什么问题? 如果有区别,我正在使用 magento 1.9 版。

【问题讨论】:

    标签: .htaccess magento gzip


    【解决方案1】:

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

    启用后问题就解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-12
      • 2018-07-15
      • 2016-03-09
      • 2014-03-23
      • 1970-01-01
      • 2016-10-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多