Hello,
Here is my PHP Code
$phpver = phpversion();
$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;
$do_gzip_compress = FALSE;
if ($phpver >= '4.0.4pl1' && (strstr($useragent,'compatible') || strstr($useragent,'Gecko'))) {
if (extension_loaded('zlib')) {
ob_start('ob_gzhandler');
}
}
header('Content-type: text/javascript;charset=utf-8');
header('Expires: '.gmdate("D, d M Y H:i:s", time() + 3600*24*365).' GMT');
echo "TEST";
I basically want to cache the content (on client side) forever as well as gzip it. However I am not sure if the above is the best way. I do not want to use any third party scripts. Is my client side caching headers enough? Do I need to add more? Also, will this interfere with Apache's native gzipping (which is turned on the server)- will it gzip twice?
Thank you for your time.