From: Jason Woofenden Date: Thu, 12 Mar 2009 01:25:21 +0000 (-0400) Subject: added http_cache_forever() X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=commitdiff_plain;h=88edfcf26c7b4cdbd083dede0834de5cf6f16999 added http_cache_forever() --- diff --git a/http.php b/http.php index b82e3d1..1abd50b 100644 --- a/http.php +++ b/http.php @@ -92,4 +92,11 @@ function redirect($url, $status = '302 Moved Temporarily', $message = '') { exit(); } +# output http headers to allow caching of this page forever +function http_cache_forever($cache_control = 'public') { + header('Last-Modified: '.gmdate('D, d M Y H:i:s', 5025) . ' GMT'); # long time ago + header("Cache-Control: $cache_control"); + header('Expires: ' . gmdate('D, d M Y H:i:s',time()+31536000) . ' GMT'); # rfc 2616 says not to go more than a year in the future +} + ?>