[英]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.