简体   繁体   English

WordPress:PageSpeed Insights中的“通过有效的缓存策略为静态资产提供服务”

[英]WordPress: “Serve static assets with an efficient cache policy” in PageSpeed Insights

WordPress: "Serve static assets with an efficient cache policy" in PageSpeed Insights WordPress:PageSpeed Insights中的“通过有效的缓存策略为静态资产提供服务”

I got a diagnostic result of Serve static assets with an efficient cache policy on my wordpress site. 在我的wordpress网站上Serve static assets with an efficient cache policy ,我得到了Serve static assets with an efficient cache policy的诊断结果。

I think this is a browser cache issue, and added the following .htaccess code. 我认为这是浏览器缓存问题,并添加了以下.htaccess代码。

But the problem has not been solved. 但是问题还没有解决。

I think that something is wrong. 我认为出了点问题。

What should I fix? 我该怎么解决?

#.htacess


AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg

<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 2 days"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType text/css "access plus 1 days"
ExpiresByType text/javascript "access plus 1 weeks"
ExpiresByType image/gif "access plus 1 weeks"
ExpiresByType image/jpeg "access plus 1 weeks"
ExpiresByType image/png "access plus 1 weeks"
ExpiresByType image/x-icon "access plus 1 weeks"
ExpiresByType application/pdf "access plus 1 weeks"
ExpiresByType application/javascript "access plus 1 weeks"
ExpiresByType application/x-javascript "access plus 1 weeks"
ExpiresByType application/x-shockwave-flash "access plus 216000 seconds"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
</ifModule>

ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"

我还没有确切测试满足此条件的最短时间,但是PSI希望使用更长的缓存时间,将到期时间设置为一年通常可以满足该条件。

暂无
暂无

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

相关问题 Wordpress 安装的 Pagespeed Insights 中未捕获的错误 - Uncaught error in Pagespeed Insights on Wordpress installation 如何修复错误“灯塔返回错误:NO_FCP。” 安装缓存模块后,由我的网站“Wordpress”上的“PageSpeed Insights”返回 - how can I fix the error “Lighthouse returned error: NO_FCP.” returned by “PageSpeed Insights” on my site “Wordpress” after install of a cache module google pageSpeed Insights,javascript IS折叠在WORDPRESS下方 - google pageSpeed Insights, javascript IS loaded below the fold WORDPRESS PageSpeed Insights如何处理WordPress中的js.cookie.min? - PageSpeed Insights what to do with js.cookie.min in WordPress? Google PageSpeed见解 - Google PageSpeed Insights 是否有任何 Wordpress 网站在 Google 的 PageSpeed Insights 上得分超过 90? - Are there any Wordpress websites that have scored over 90 on Google's PageSpeed Insights? 如何提高从Google PageSpeed Insights获得低分的WordPress WooCommerce网站的性能? - How can I improve the performance of a WordPress WooCommerce website that gets a low speed score from Google PageSpeed Insights? Google PageSpeed Insights API 无法连接到我的 Wordpress 博客来测试速度 - Google PageSpeed Insights API can't connect to my Wordpress blog to test speed Pagespeed见解显示“后端错误” - Pagespeed insights showing 'Backend Error' Google PageSpeed Insights API 集成 - Google PageSpeed Insights API integration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM