title: PHP cache header override
body: <p>I've been through over 100 answers here, lots to try, NOTHING working??</p>
  
  <p>Have a PHP based site.  I need caching OFF for all .php files EXCEPT A SELECT FEW.</p>
  
  <p>So, in .htaccess, I have the following:</p>
  
  <pre><code>ExpiresActive On
  # Eliminate caching for certain dynamic files
  &lt;FilesMatch "\.(php|cgi|pl)$"&gt;
  ExpiresDefault A0
  Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
  Header set Pragma "no-cache"
  &lt;/FilesMatch&gt;
  </code></pre>
  
  <p>Using Firebug, I see the following:</p>
  
  <pre><code>Cache-Control   no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform
  Connection  Keep-Alive
  Content-Type    text/html
  Date    Sun, 02 Sep 2012 19:22:27 GMT
  Expires Sun, 02 Sep 2012 19:22:27 GMT
  Keep-Alive  timeout=3, max=100
  Pragma  no-cache
  Server  Apache
  Transfer-Encoding   chunked
  X-Powered-By    PHP/5.2.17
  </code></pre>
  
  <p>Hey, Looks great!</p>
  
  <p>BUT, I have a couple .php pages I need some very short caching on.</p>
  
  <p>I thought the simple answer was having this added to the very top of each php page in which I want caching enabled:</p>
  
  <pre><code>&lt;?php header("Cache-Control: max-age=360"); ?&gt;
  </code></pre>
  
  <p>Nope.</p>
  
  <p>Then I tried various versions of the above.  Nope.</p>
  
  <p>Then I tried meta http-equiv variations.  Nope.</p>
  
  <p>Then I tried variations of the .htaccess code along with the above variations, such as limiting it to:</p>
  
  <pre><code># Eliminate caching for certain dynamic files
  &lt;FilesMatch "\.(php|cgi|pl)$"&gt;
  Header set Cache-Control "no-cache, max-age=0"
  &lt;/FilesMatch&gt;
  </code></pre>
  
  <p>Nope.</p>
  
  <p>It seems nothing I do will allow a single .php to be cache enabled with the .htaccess code in place, short of removing the statements from the .htaccess file altogether.</p>
  
  <p>Where am I going wrong? What do I have to do to get individual php pages to be cacheable while the rest remain off??</p>
  
  <p>Thank you for any thoughts.</p>