Results 1 to 10 of 10

Thread: Turning off Gzip

  1. #1
    Join Date
    Apr 2008
    Posts
    407

    Default Turning off Gzip

    As some of you may or may not have noticed, Bluehost has recently enabled gzip for all sites, at least on my server.

    Normally this would not be a problem (and in fact it's great because loading times will be much smaller), but I had a script that required the output to be sent to the user as it was generated, not once the entire script was finished (otherwise known as output buffering). Gzip inherently buffers the output, so I had to find a way to disable it.

    Thinking that mod_gzip was the problem, I tried adding "mod_gzip_on No" in my .htaccess file. Unfortunately, this gave me a 500 internal server error.

    In a rather unhelpful response to my support ticket, one of the reps told me
    Also, we don't have mod_gzip, but we do have
    mod_deflate which is basically the updated version of this mod.
    So I also tried "mod_deflate_on No" in my .htaccess file, but that didn't work either.

    I finally stumbled upon the solution while searching on the Internet. Add this line to your .htaccess file:
    Code:
    SetEnv no-gzip dont-vary
    If you want to turn off gzip for a specific file only, you can use this:
    Code:
    SetEnvIfNoCase Request_URI MY_FILE_NAME\.php$ no-gzip dont-vary
    Obviously change MY_FILE_NAME to the name of the file.

    This is working for me. It disables gzip compression and the accompanying output buffering. It should allow you to control output buffering via PHP if you want to, as well. :)

    Since there's nothing mentioned in the knowledgebase, Bluehost no longer offers support for server/scripting issues via Live Chat (:mad:), and the ticket system wasn't very helpful on the issue, I thought I would post the solution here for future reference. Hopefully somebody benefits from it. :)
    Last edited by Eriksrocks; 12-05-2009 at 11:27 AM. Reason: Minor typo.

  2. #2
    Join Date
    Oct 2009
    Posts
    5

    Default

    I'm a bit confuzed :confused:

    Do we need any stand alone decompression utilities to make this effective, like pkzip, or is winzip sufficient? I've gotten rid of all that, so I'm not sure...
    Last edited by farcaster; 12-28-2009 at 05:08 PM. Reason: no need to quote a large post right above you

  3. #3
    Join Date
    Jan 2010
    Posts
    3

    Default

    All modern browsers support gzip compression?
    __________________
    Tom
    Last edited by lotosmot; 02-07-2010 at 03:17 AM.

  4. #4
    Join Date
    Nov 2006
    Location
    Sydney, Australia
    Posts
    4,944

    Default

    Quote Originally Posted by dovemaster View Post
    I'm a bit confuzed :confused:

    Do we need any stand alone decompression utilities to make this effective, like pkzip, or is winzip sufficient? I've gotten rid of all that, so I'm not sure...
    No you don't need any decompression utility as the web browsers can all handle it internally (if they couldn't then there wouldn't be any point having it on as the browsers that can't decompress the page can't display it).

  5. #5
    Join Date
    Jan 2007
    Posts
    137

    Default

    Quote Originally Posted by lotosmot View Post
    All modern browsers support gzip compression?
    __________________
    Tom Strap
    Yes, it's some older browsers that some people still use that don't fully implement gzip, but you can account for them in your site's root .htaccess file using something like this...

    Code:
    # This turn on compression for everything except things
    # like images because they are already compressed
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|t?gz}zip|bz2|sit|rar|flv|pdf)$ \
    no-gzip dont-vary
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    Also see: http://developer.yahoo.com/performance/rules.html#gzip

  6. #6
    Join Date
    Nov 2008
    Location
    Houston, TX
    Posts
    29

    Default

    I already had GZip running on my site (http://rk.md) since day one, but is there a recommended way to transition to the DEFLATE algorithm? I've tried adding the "SetEnv no-gzip dont-vary" to my .htaccess in addition to "SetOutputFilter DEFLATE", but upon checking my site's compression status via a third party site, no compression was detected. In other words, I successfully DISABLED Gzip but couldn't enable Deflate.

    Am I missing something? :o

  7. #7
    Join Date
    Apr 2008
    Location
    Chasing the Holy Grail - Pacific Northwest
    Posts
    1,312

    Default

    I can refer you to this blog post by Matt Heaton, CEO and I think Chief Techie at Bluehost on what he came up with concerning gzip. You can always access his blog column via the link on the main Bluehost home page.

    http://www.mattheaton.com/?p=228
    In the Hyperion universe, a farcaster is an instantaneous transportation device.
    Experience: The thing you get just after you need it.

  8. #8
    Join Date
    Nov 2008
    Location
    Houston, TX
    Posts
    29

    Default

    Thanks Farcaster! It's actually that post which initiated my original question about implementing mod_deflate. Matt didn't put up any instructions, and every HTML compression verification test I try does not return "deflate" as the compression I'm using (even when I've disabled GZip).

  9. #9
    Join Date
    Jul 2010
    Posts
    1

    Default Re:

    I have a large portal that receives on average 20,000 page views a day, the site was quite slow after active compression HTML, it was quite faster. hugs.

  10. #10
    Join Date
    Jul 2010
    Posts
    13

    Default

    Quote Originally Posted by lotosmot View Post
    All modern browsers support gzip compression?
    __________________
    Tom
    Yup most modern browsers support gzip. However, you may have trouble if people are using old browsers.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •