gpt4 book ai didi

.htaccess - htaccess 'Header unset Last-Modified' 缓存问题

转载 作者:行者123 更新时间:2023-12-01 01:35:07 24 4
gpt4 key购买 nike

我试图在我的 htaccess 文件中设置一些缓存控制选项。

目前它看起来像这样:

<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf|css|js|html|pdf)$">
Header set Cache-Control "max-age=2592000, public, must-revalidate"
Header unset ETag
FileETag None
</FilesMatch>

但是我读到(并想添加)Header unset Last-Modified,所以它会是这样的:
<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf|css|js|html|pdf)$">
Header set Cache-Control "max-age=2592000, public, must-revalidate"
Header unset Last-Modified
Header unset ETag
FileETag None
</FilesMatch>

但是,使用它(根据 Firebug)根本不会从缓存中加载任何内容(而第一种技术会加载所有内容)

难道我做错了什么?语法似乎是正确的。

一种。

最佳答案

语法正确,但用法不对。
根据此处找到的“速度提示:删除上次修改的标题”:http://www.askapache.com/htaccess/apache-speed-last-modified.html

If you remove the Last-Modified and ETag header, you will totally eliminate If-Modified-Since and If-None-Match requests and their 304 Not Modified Responses, so a file will stay cached without checking for updates until the Expires header indicates new content is available!



还:

By removing both the ETag header and the Last-Modified headers from your static files (images, javascript, css) browsers and caches will not be able to validate the cached version of the file vs. the real version. By also including a Cache-Control header and Expires header, you can specify that certain files be cached for a certain period of time, and you magically (this is a really unique trick I promise) eliminate any validation requests!!



有关更多详细信息,请参阅原始链接。

关于.htaccess - htaccess 'Header unset Last-Modified' 缓存问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2546711/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com