如何在APACHE中为静态资源的HTTP标头设置到期日期或最长期限 [英] How do you set the expiry date or a maximum age in the HTTP headers for static resources in APACHE
本文介绍了如何在APACHE中为静态资源的HTTP标头设置到期日期或最长期限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
After running Google page speed online , it remarks that I should be: Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.
And it lists a lot of plain images , my javascript files and the style sheets.
How can I set this expiry date for these static files ? I thought this was done automatically by the browser ?
我正在使用APACHE 2.2.8
i'm using APACHE 2.2.8
推荐答案
您提到的来自本地磁盘的数据称为 Web缓存。请参阅: http://en.wikipedia.org/wiki/Web_cache [ ^ ]。
首先,我会推荐这个关于缓存控制的完整教程: http://www.mnot.net/cache_docs/ [ ^ ]。
等等:
http://palizine.plynt.com/issues/2008Jul/ cache-control-attributes / [ ^ ],
http://www.web-caching.com/ [ ^ ]。
-SA
The data "from local disk" you mention is called Web cache. Please see: http://en.wikipedia.org/wiki/Web_cache[^].
First of all, I would recommend this complete tutorial on cache control: http://www.mnot.net/cache_docs/[^].
Some more:
http://palizine.plynt.com/issues/2008Jul/cache-control-attributes/[^],
http://www.web-caching.com/[^].
—SA
这篇关于如何在APACHE中为静态资源的HTTP标头设置到期日期或最长期限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文