Jump to content

GZIP question


robert_gsfame

Recommended Posts

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

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.