Search code examples
apache.htaccessmod-expires

Add expires header without mod_expires?


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?


Solution

  • 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