最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - why would anyone set (Apache mod_expires parameter) ExpiresByType to "access plus 0 seconds"? - S

programmeradmin0浏览0评论

In reviewing the answer to this post, I don't understand why 0 seconds is used for best practice here:

ExpiresByType text/html "access plus 0 seconds"

I think this means that whenever a user visits the website, the html page is always downloaded instead of pulled from cache. Is that right?

Is this what people typically set for this variable? If so why? If not, which scenarios benefit from setting it to 0 seconds?

In reviewing the answer to this post, I don't understand why 0 seconds is used for best practice here:

ExpiresByType text/html "access plus 0 seconds"

I think this means that whenever a user visits the website, the html page is always downloaded instead of pulled from cache. Is that right?

Is this what people typically set for this variable? If so why? If not, which scenarios benefit from setting it to 0 seconds?

Share Improve this question edited May 23, 2017 at 11:59 CommunityBot 11 silver badge asked Oct 30, 2013 at 20:27 ggkmathggkmath 4,25624 gold badges76 silver badges133 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

If text/html only meant "content from static HTML files", you'd be right, and you'd want to set a longer cache life. But server-side scripts typically also return a web page; that is, their responses' Content-Type will often be text/html as well. And if all HTML were cached, dynamically generated content might not appear to update properly.

If you wanted to expire only non-static HTML, you might be able to do something like

<FilesMatch "\.php$">
    ExpiresByType text/html "access plus 0 seconds"
</FilesMatch>

(using PHP as an example).

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论