Accessing HTTP response in Apache Rewrite/SetEnvIf (content type, expires headers)

apache-2.2mod-rewrite

Is it possible to access response object data in Apache

  • SetEnvIf
  • RewriteCond

… so that one could manipulate headers based on content type and caching output?

From the documentation it seems that this is not possible. Is there any other module which could allow this kind of manipulation (setting environment variables based on response headers)?

Best Answer

mod_rewrite doesn't operate on headers, but you CAN do this with mod_headers, which has an example for this exact situation.