[英]How to unset Cache-Control max-age in .htaccess?
I'm trying to unset Cache-Control's max-age via .htaccess. 我正在尝试通过.htaccess取消Cache-Control的最大使用时间。 The following removes Cache-Control entirely:
以下内容将完全删除Cache-Control:
Header unset Cache-Control
How do I tell it to remove just "max-age?" 我如何告诉它仅删除“最大年龄”? Thanks.
谢谢。
In Apache 2.2.4 there is a new Header edit action that allows you to do exactly these kind of manipulations. 在Apache 2.2.4中,有一个新的Header编辑操作,使您可以精确地进行这类操作。
From the Apache documentation : If this request header exists, its value is transformed according to a regular expression search-and-replace. 来自Apache文档 : 如果此请求标头存在,则其值将根据正则表达式“搜索并替换”进行转换。 The value argument is a regular expression, and the replacement is a replacement string, which may contain backreferences.
value参数是一个正则表达式,替换项是替换字符串,其中可能包含反向引用。
However, the regex needed would be fairly complicated. 但是,所需的正则表达式将相当复杂。 Hence I suggest to just use Header set to override the current Cache-Control if you can hardcode the value .
因此, 如果可以对值进行硬编码,我建议仅使用Header集来覆盖当前的Cache-Control。 Using the set action overrides the previous value containing max-age.
使用set操作将覆盖先前包含max-age的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.