header('Expires: ' . gmdate('D, d M Y H:i:s', $cachemtime + 3600) . ' GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $mtime) . ' GMT'); if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $mtime) { // This works around a bug in header(), where it would translate "HTTP/1.1 // 304 Not Modified" to "Status: 304 OK". header((strpos(PHP_SAPI, 'cgi') === 0 ? 'Status: 304 Not Modified' : 'HTTP/1.1 304 Not Modified')); } else { readfile($file); }