Setting up expire header for PHP pages
If we set expire header for a page, javascript files, style sheets or images, we can reduce the number of requests from client and also we can increase the page loading time. For apache server we can setup expire header using .htaccess file. In many cases we are displaying images via PHP. need to set up expire header for our page. Using the below code
header("Content-type: image/gif");
$expires = 60*60*24*30;//second*minute*hour*days
header("Pragma: public");
header("Cache-Control: maxage=".$expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
