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"
</filesmatch>

Source:
http://www.askapache.com/htaccess/speed-up-your-site-with-caching-and-cache-control.html

Leave a Reply

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