我如何判断 Leverage 浏览器缓存已打开?

发布于 2024-12-07 16:10:16 字数 1051 浏览 0 评论 0原文

我正在尝试在我的网站上的 images/js/css ext.. 上设置到期日期,因为我在我正在使用的工具中看到 页面速度 它将有助于性能:

The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:

http://somesite.com/images/chat/footer_btn_chat_on.png (expiration not specified)
http://somesite.com/images/footer.jpg (expiration not specified)
http://somesite.localhost/inc/cache/all.js (expiration not specified)

所以我将其添加到 htaccess 并刷新页面,但仍然是(未指定到期时间):

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/html "access plus 2 days"
ExpiresByType image/gif "access plus 60 days"
ExpiresByType image/jpg "access plus 60 days"
ExpiresByType image/png "access plus 60 days"
ExpiresByType application/x-javascript "access plus 60 days"
ExpiresByType text/css "access plus 60 days"
ExpiresByType image/x-icon "access plus 360 days"
</IfModule>

我需要打开任何东西吗?有办法让它发挥作用吗?

I am trying to set the expiring date on the images/js/css ext.. on my site because i see in a tool that I am using Page Speed that it will help performance:

The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:

http://somesite.com/images/chat/footer_btn_chat_on.png (expiration not specified)
http://somesite.com/images/footer.jpg (expiration not specified)
http://somesite.localhost/inc/cache/all.js (expiration not specified)

So I added this to the htaccess and refreshed the page and still the (expiration not specified):

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/html "access plus 2 days"
ExpiresByType image/gif "access plus 60 days"
ExpiresByType image/jpg "access plus 60 days"
ExpiresByType image/png "access plus 60 days"
ExpiresByType application/x-javascript "access plus 60 days"
ExpiresByType text/css "access plus 60 days"
ExpiresByType image/x-icon "access plus 360 days"
</IfModule>

Do I need to turn anything on or is there a way to get this to work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文