robert_gsfame Posted August 31, 2010 Share Posted August 31, 2010 I have just googling in order to find out how to do GZIP so that user can load web page faster. n i found some article which stated that i have to put this script only. <?php ob_start( 'ob_gzhandler' ); ?> my question is...is it doing the zip? if it is correct where should i put that script, in every page which is needed to be compressed or inside index page only? thx in advance Quote Link to comment Share on other sites More sharing options...
ocpaul20 Posted September 1, 2010 Share Posted September 1, 2010 As I understand it, you have to put this on every page at the start before any output as it is using the buffer. Then at the end of the page you flush it out to display it on the browser. I believe that Google webmaster tools has a section where you can see how long your web pages take to load and it analyses some of the image, ccs, and other files your pages call in order to produce your web page. Hope that helps a little bit. so at the very top... <?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); and then at the end <?php ob_flush(); ?> </body></html> At least that what seems to work for me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.