首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >wordpress Gzip表示不起作用--如何在浏览器中检查

wordpress Gzip表示不起作用--如何在浏览器中检查
EN

Stack Overflow用户
提问于 2016-12-05 12:34:45
回答 2查看 619关注 0票数 0

我已经在我的.htaccess文件中安装了Gzip代码,它也是从options.php中启用的,但是它没有显示效果。我已经检查过element -> network

但是,没有任何编码类型,我如何使它。以下是我的.htaccess代码:

# Compress HTML, CSS, JavaScript, Text, XML and fonts AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType压缩应用程序/rss+xmlAddOutputFilterByType压缩应用程序/vnd.ms-fontobject AddOutputFilterByType缩小应用程序/x字体 AddOutputFilterByType压缩应用程序/x字体-opentype AddOutputFilterByType缩小应用程序/x字体 AddOutputFilterByType压缩应用程序/x字体-真型 AddOutputFilterByType缩小应用程序/x字体 AddOutputFilterByType缩减应用程序/x-javascript AddOutputFilterByType压缩application/xhtml+xml AddOutputFilterByType缩减应用程序/xml AddOutputFilterByType缩减字体/opentype AddOutputFilterByType缩减字体/ AddOutputFilterByType缩小字体/ttf AddOutputFilterByType缩小图像/svg+xml AddOutputFilterByType缩小图像/x图标 AddOutputFilterByType缩减文本/css AddOutputFilterByType缩减文本/html AddOutputFilterByType缩减文本/javascript AddOutputFilterByType缩减文本/普通AddOutputFilterByType压缩文本/xmlRemove浏览器bug(只适用于非常老的浏览器) BrowserMatch ^Mozilla/4 gzip专用文本/html BrowserMatch ^Mozilla/4.0678 no-gzip BrowserMatch \bMSIE !no-gzip!gzip专用-text/html头附加不同的用户-代理

EN

回答 2

Stack Overflow用户

发布于 2016-12-05 12:41:09

如果您的网站位于实时服务器上,则可以使用此网站http://checkgzipcompression.com/检查Gzip压缩是否在线打开或关闭。

若要签入铬,请按F12打开F12

  • 转到网络选项卡。
  • 重新加载页面,以便它能够捕获所有请求。
  • 找到响应头Content-Encoding: gzip
票数 0
EN

Stack Overflow用户

发布于 2016-12-05 13:06:37

Gzip是什么?

GZIP压缩是在将页面发送给访问者之前在web服务器上捆绑(压缩)页面。这节省了带宽,因此大大提高了页面的加载速度。访问者的网页浏览器会自动解压网页。

通过插件启用

https://wordpress.org/plugins/check-and-enable-gzip-compression/

不工作的原因

  • 在不同服务器上运行
    • 启用NGINX webservers服务器上的压缩
    • 启用Apache webservers服务器上的压缩
    • 启用在小型webservers服务器上的压缩

参考链接:

https://varvy.com/pagespeed/enable-compression.html

编辑(我使用以下代码实现压缩)

代码语言:javascript
运行
复制
    AddOutputFilterByType DEFLATE text/plain #content encoding Speed
        AddOutputFilterByType DEFLATE text/html #content encoding Speed
        AddOutputFilterByType DEFLATE text/xml #content encoding Speed
        AddOutputFilterByType DEFLATE text/css #content encoding Speed
        AddOutputFilterByType DEFLATE application/xml #content encoding Speed
        AddOutputFilterByType DEFLATE application/xhtml+xml #content encoding Speed
        AddOutputFilterByType DEFLATE application/rss+xml #content encoding Speed
        AddOutputFilterByType DEFLATE application/javascript #content encoding Speed
        AddOutputFilterByType DEFLATE application/x-javascript #content encoding Speed
        AddType x-font/otf .otf #content encoding Speed
        AddType x-font/ttf .ttf #content encoding Speed
        AddType x-font/eot .eot #content encoding Speed
        AddType x-font/woff .woff #content encoding Speed
        AddType image/x-icon .ico #content encoding Speed
        AddType image/png .png #content encoding Speed
        # content encoding Speed -- Ends here
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40974406

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档