开发者

How to unset Cache-Control max-age in .htaccess?

开发者 https://www.devze.com 2023-02-16 21:06 出处:网络
I\'m trying to unset Cache-Control\'s max-age via .htaccess. The following removes Cache-Control entirely:

I'm trying to unset Cache-Control's max-age via .htaccess. The following removes Cache-Control entirely:

Header unset Cache-Control

How do I tell it to remove j开发者_如何学Pythonust "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.

From the Apache documentation: If this request header exists, its value is transformed according to a regular expression search-and-replace. The value argument is a regular expression, and the replacement is a replacement string, which may contain backreferences.

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. Using the set action overrides the previous value containing max-age.

0

精彩评论

暂无评论...
验证码 换一张
取 消