Help to enable gzip compression

Discussion in 'Apache' started by bobs, May 5, 2010.

  1. #1
    Need help to enable gzip compression in apache. One of my open source website takes long to open. I used following code in .htaccess file but it shows internal server error.



    <Location />

    # Insert filter
    SetOutputFilter DEFLATE

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
    # the above regex won't work. You can use the following
    # workaround to get the desired effect:
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

    # Don't compress images
    SetEnvIfNoCase Request_URI \

    \.(?:gif|jpe?g|png)$ no-gzip dont-vary


    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary

    </Location>


    Should i need to enable something on server.
     
    bobs, May 5, 2010 IP
  2. crashus

    crashus Active Member

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #2
    try to remove this one:

    Header append Vary User-Agent env=!dont-vary
     
    crashus, May 5, 2010 IP
  3. liveallinfo

    liveallinfo Peon

    Messages:
    317
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for this. I'm looking for this solution.

    I want to compress images also. What will be the code then?
     
    liveallinfo, May 13, 2010 IP