Hi, my shared host does not have gzip enabled,
so I read how to use gzip despite of that.
I have minified my 3 .js files (about 200 kbs), I have made them 1 file then I gzipped them with an online tool, so I now have a gzipped file with 36kb.
I renamed the .gz to .jgz (for safari).
I have this on top of my testpage:
<?php
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))
ob_start("ob_gzhandler");
else
ob_start();
?>
in the html I have the .js as a link
and in the htaccess I have this:
RewriteEngine on
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.jgz -f
RewriteRule (.*)\.js$ $1\.js.jgz [L]
AddType "text/javascript" .js.jgz
AddEncoding gzip .jgz
<FilesMatch "\.(gif|jpeg|jgz|gz|jpg|js|pdf|css|GIF|png|flv|swf|ico)$">
Header set Cache-Control: "max-age=1296000"
</FilesMatch>
I can see the jgz file is being cached using firebut/page speed, however when I click I can see the max cpu goes up, so I suppose the server have to unzip the .jgz file everytime.
I wonder if it is so and if there is a way to cache the unzipped file.
Thanks in advance