I can't get my Gzip to work

4 replies
I have tried all kinds of variations but I can't can my gzip to work. My site has only html files (not WP). I'm pretty confused with all the different code suggestions I see. I need to know what is the right code. Here's the code I have on my .htaccess:

<filesMatch ".(ico|html|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$" >
SetOutputFilter DEFLATE
Header set Cache-Control "public"
Header set Expires "Thu, 16 Apr 2015 20:00:00 GMT"
Header unset ETag
FileETag None
</filesMatch>

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
#End Gzip


Thanks for the help
#gzip #work
  • Profile picture of the author Michael71
    What's your Apache version?

    Is mod_deflate (or mod_gzip for older Apache versions) installed?

    Are you maybe using nginx?
    Signature

    HTML/CSS/jQuery/ZURB Foundation/Twitter Bootstrap/Wordpress/Frontend Performance Optimizing
    ---
    Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu

    {{ DiscussionBoard.errors[8113035].message }}
  • Profile picture of the author WpHelpSupport
    Try adding this

    Code:
    # GZIP
    SetOutputFilter DEFLATE
    AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4.0[678] no-gzip
    BrowserMatch bMSIE !no-gzip !gzip-only-text/html
    BrowserMatch bMSI[E] !no-gzip !gzip-only-text/html
    SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip
    Header append Vary User-Agent env=!dont-vary
    {{ DiscussionBoard.errors[8113253].message }}
  • Profile picture of the author Michael71
    This code

    Code:
    Header set Cache-Control "public"
    Header set Expires "Thu, 16 Apr 2015 20:00:00 GMT"
    Header unset ETag
    FileETag None
    has nothing to do with mod_deflate.

    What you need, if you have mod_deflate installed, is simply this code:

    Code:
    # compress all text & html & xml & css
    AddOutputFilterByType DEFLATE text/html  
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE image/png
    AddOutputFilterByType DEFLATE image/jpeg
    AddOutputFilterByType DEFLATE image/gif
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE application/octet-stream .otf .ttf
    This is some code I am using on my servers. Nothing more, nothing less is needed for mod_deflate
    Signature

    HTML/CSS/jQuery/ZURB Foundation/Twitter Bootstrap/Wordpress/Frontend Performance Optimizing
    ---
    Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu

    {{ DiscussionBoard.errors[8113759].message }}

Trending Topics