1

I want to enable cache control for my page with this code :

<?php
    $expires = 60 * 60 * 24 * 14;
    header("Pragma: public");
    header("Cache-Control: maxage=" . $expires);
    header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
?>
<!DOCTYPE html>
<html lang="en">...

I have added that at very begging of the page, but it does not work and I get this response :

Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:40256
Content-Type:text/html
Date:Fri, 28 Mar 2014 18:57:59 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=5, max=100
Pragma:no-cache
Server:Apache/2.4.6 (Ubuntu)
Vary:Accept-Encoding
X-Powered-By:PHP/5.5.7-1+sury.org~precise+1

Where is the problem ?

Ata
  • 12,126
  • 19
  • 63
  • 97

0 Answers0