Add expires header without mod_expires?

Sebi picture Sebi · Sep 2, 2010 · Viewed 7.4k times · Source

I know that I can add expires header using mod_expires. However, what can I do if the Apache server doesn't have mod_expires installed and I don't want to route the access to the files through a scripting language like PHP?

Answer

Gumbo picture Gumbo · Sep 2, 2010

You could use mod_header to set the header field manually:

Header set Expires "..."

But since Expires requires an absolute time, use Cache-Control’s max-age parameter for times relative to the access time:

Header merge Cache-Control max-age=3600