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"


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.