- I can't get Gzip

Hi - I can't get Gzip compression to work :slight_frown:

  • Sajid

    Hello bengardiner,

    Thanks for granting support staff access. I can see that the automatic method of enabling Gzip compression did not worked for you. That is most common on shared hosting.

    If adding the code manually in .htaccess file did not worked for you then you have to add it in vhosts.conf or httpd.conf files (of course if you have access to these files).

    On shared hosting, you normally don't have access to these files. In this case, please contact your hosting support and ask them to add the required code for your website vhosts.conf or httpd.conf.

    Just pass on the following information to your hosting support, if you are not sure what to tell.

    If .htaccess does not work, and you have access to vhosts.conf or httpd.conf try this:

    1. Look for your site in the file and find the line that starts with <Directory> - add the code below into that section and save the file.
    2. Reload Apache.

    <IfModule mod_deflate.c>
    <IfModule mod_setenvif.c>
    <IfModule mod_headers.c>
    SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
    RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
    </IfModule>
    </IfModule>
    <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE "application/atom+xml" \
    "application/javascript" \
    "application/json" \
    "application/ld+json" \
    "application/manifest+json" \
    "application/rdf+xml" \
    "application/rss+xml" \
    "application/schema+json" \
    "application/vnd.geo+json" \
    "application/vnd.ms-fontobject" \
    "application/x-font-ttf" \
    "application/x-javascript" \
    "application/x-web-app-manifest+json" \
    "application/xhtml+xml" \
    "application/xml" \
    "font/eot" \
    "font/opentype" \
    "image/bmp" \
    "image/svg+xml" \
    "image/vnd.microsoft.icon" \
    "image/x-icon" \
    "text/cache-manifest" \
    "text/css" \
    "text/html" \
    "text/javascript" \
    "text/plain" \
    "text/vcard" \
    "text/vnd.rim.location.xloc" \
    "text/vtt" \
    "text/x-component" \
    "text/x-cross-domain-policy" \
    "text/xml"

    </IfModule>
    <IfModule mod_mime.c>
    AddEncoding gzip svgz
    </IfModule>

    </IfModule>

    Take care and have a nice day :slight_smile:

    Best Regards,
    Sajid

  • Nastia

    Hello bengardiner , I trust all is well!

    Would you please try the code bellow, replace it with the one that Justin have posted so it will not cause any tribles because it's similar, to see if this will work for you?

    <ifModule mod_deflate.c>
    <FilesMatch "\.(css|js|x?html?|php)$">
    SetOutputFilter DEFLATE
    </FilesMatch>
    </ifModule>

    Once you add it clear the cache on your page and test again.

    If this doesn't help, I think you may want to get in touch with your host again and ask them to double check Apache"mod_deflate" config again to allow following mime types:

    text/javascript

    Let me know how it went!

    Cheers,
    Nastia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.