Skip to Content

Apache - Force caching dynamic PHP content with mod_headers

Normally you want dynamic content to be fresh and not catchable. But sometimes it may be useful to cache it, like when you have website behind reverse proxy. To do this try something like this:

<filesmatch "\.(php|cgi|pl)$">
Header unset Pragma
Header unset Expires
Header set Cache-Control "max-age=3600, public"

comments powered by Disqus