GZip

Jim,

What do you think about Gzipping a website. I read that putting
<?php
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], ‘gzip’)) {
ob_start("ob_gzhandler");
}
else {
ob_start();
}
?>
into the <head> can reduce download time by 60%
http://www.roscripts.com/How_to_speed_up_your_website-175.html

Roger

Comments

  1. AMPC says:

    Note that some browsers may say they accept gzip even though they do not, so some visitors may have problems.

    Best regards,

    Jim.

  2. Actual says:

    Jim,
    Can you change <Files *.html> to <Files *.html *.css> ?

    Roger

  3. Actual says:

    Jim,
    Are those commands Apache version specific? My webhost uses Apache 2.2.9.
    The results of using these compression codes I would think be seen in View, Page Source, but would the code be compressed in the wordpress editor too (if you’re using wordpress)?

    Roger

  4. AMPC says:

    Hi Roger,

    I’m not sure how you would handle it in your situation as your pages come across as /page/ rather than page.html or page.php

    There is nothing wrong with the way you have your pages named, I do this as well, I’m just not sure how you would account for that.

    If you find out, please post it here.

    Regards,

    Jim.

  5. Actual says:

    Jim,
    Bluehost wrote back
    Unfortunately those commands won’t work with our system. We do not have mod_deflate.

    Have any thoughts?

    maybe I should ask them about this command
    <?php
    if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], ‘gzip’)) {
    ob_start("ob_gzhandler");
    }
    else {
    ob_start();
    }
    ?>

    Roger

  6. Actual says:

    Jim,

    Bluehost twice said they don’t have mod deflate even though they have Apache 2.2, so I’ll have to consider the php command.

    On that website they say,
    "You can get the same benefits by adding some very simple PHP code (see below) to your web pages.", but where would the PHP go, in the <head> or in the body?

    <?php
    if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], ‘gzip’)) {
    ob_start("ob_gzhandler");
    }
    else {
    ob_start();
    }
    ?>

    Roger

  7. AMPC says:

    Hi Roger,

    That would go in your header.php file at the very top.

    Best regards,

    Jim.

Speak Your Mind