1

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 just "max-age?" Thanks.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.