# Apache - Force caching dynamic PHP content with mod\_headers

DevFeed: [Apache - Force caching dynamic PHP content with mod\_headers](<https://devfeed.tech/articles/apache-force-caching-dynamic-php-content-with-mod-headers-27626.md>)

Original publisher: [Read original article](<https://gagor.pro/2015/12/apache-force-caching-dynamic-php-content-with-mod_headers/>)

Author: Tom

Published: 2015-12-29T00:00:00Z

Content type: tutorial

Language: en

Sources: [Tomasz Gągor](<https://devfeed.tech/sources/tomasz-gagor.md>)

Topics: [Caching](<https://devfeed.tech/topics/caching.md>), [PHP](<https://devfeed.tech/topics/php.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [servers](<https://devfeed.tech/topics/servers.md>), [Website](<https://devfeed.tech/topics/website.md>)

Tags: [apache](<https://devfeed.tech/tags/apache.md>), [cache](<https://devfeed.tech/tags/cache.md>), [cache-control](<https://devfeed.tech/tags/cache-control.md>), [caching](<https://devfeed.tech/tags/caching.md>), [http](<https://devfeed.tech/tags/http.md>), [linux](<https://devfeed.tech/tags/linux.md>), [php](<https://devfeed.tech/tags/php.md>), [speed](<https://devfeed.tech/tags/speed.md>), [website](<https://devfeed.tech/tags/website.md>)

## AI overview

A short Apache configuration guide for caching dynamic PHP content with mod_headers, including public Cache-Control settings and removal of Pragma and Expires headers.

## Source excerpt

Normally you want dynamic content to be fresh and not cacheable. But sometimes it may be useful to cache it, like when you have website behind reverse proxy1. To do this try something like this: Add new Apache conf file <filesmatch "\.(php|cgi|pl)$"> Header unset Pragma Header unset Expires Header set Cache-Control "max-age=3600, public" </filesmatch> http://www.askapache.com/htaccess/speed-up-your-site-with-caching-and-cache-control.html external link ↩︎