Page 1 of 1

Getting gzip to work.

Posted: Sun Jan 13, 2013 9:36 pm
by i2Paq
My hoster enabled gzip for me but now I have issues getting it to work.

After contacting them the adviced me to put the following code "somewhere" in php ???

Code: Select all

<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>
The question is: where?

In my .htaccess I already have:

Code: Select all

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule> 
So after adding the code to php I should be up and running.

Re: Getting gzip to work.

Posted: Tue Jan 15, 2013 12:58 am
by i2Paq
No-one?

Re: Getting gzip to work.

Posted: Thu Aug 22, 2013 1:42 pm
by butte
I would guess, i2Paq, that you found a solution in those six months and f'got to mark it Solved, but maybe not.

From the gameplan to compress, putting that in header.php seems to make sense, perhaps above head or between head and body. Just a hunch, might even be right, dunno.