【问题标题】:"Add Expires Headers" - what about HTML?“添加过期标题” - HTML 呢?
【发布时间】:2018-12-17 22:19:59
【问题描述】:

可能是一个非常基本的问题,但我想 100% 确定...

建议在您的 htaccess 文件中放置“添加过期标题”规则,但我的问题是,我网站中的 HTML text 经常更改,即写入内容 - 所以,为了清楚起见,鉴于我的内容(文本)定期更改,添加以下内容是完全可以的?

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##

我当然希望回头客看到我的新鲜内容,所以我问这个问题

谢谢

【问题讨论】:

    标签: http-headers


    【解决方案1】:

    不,考虑到您的要求,这并不完全没问题:

    我想让回头客看到我的新鲜内容

    如果您提供的 HTML 页面的标头表明客户端可以缓存该响应直到(现在 + 两天),那么如果用户刷新该页面,则在接下来的两天内,浏览器将返回缓存的 HTML。

    【讨论】:

    • hmmm,看来这种类型的缓存真的是为一个不经常变化的网站准备的?
    猜你喜欢
    • 2016-11-28
    • 2013-09-15
    • 2012-12-08
    • 1970-01-01
    • 1970-01-01
    • 2015-11-23
    • 2020-09-28
    • 1970-01-01
    • 2016-12-06
    相关资源
    最近更新 更多