Gzip compression using .htaccess

I’m not sure what I’m placing in .htaccess file in the compression section is correct.

this is what i input into my .htaccess file.

# ------------------------------------------------------------------------------
# | Compression                                                                |
# ------------------------------------------------------------------------------

<IfModule mod_deflate.c>

    # Force compression for mangled headers.
    # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
    <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>

    # Compress all output labeled with one of the following MIME-types
    # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
    #  and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
    #  as `AddOutputFilterByType` is still in the core directives).
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE application/atom+xml 
        AddOutputFilterByType DEFLATE application/javascript 
        AddOutputFilterByType DEFLATE application/json 
        AddOutputFilterByType DEFLATE application/rss+xml 
        AddOutputFilterByType DEFLATE application/vnd.ms-fontobject 
        AddOutputFilterByType DEFLATE application/x-font-ttf 
        AddOutputFilterByType DEFLATE application/x-web-app-manifest+json 
        AddOutputFilterByType DEFLATE application/xhtml+xml 
        AddOutputFilterByType DEFLATE application/xml 
        AddOutputFilterByType DEFLATE font/opentype 
        AddOutputFilterByType DEFLATE image/svg+xml 
        AddOutputFilterByType DEFLATE image/x-icon 
        AddOutputFilterByType DEFLATE text/css 
        AddOutputFilterByType DEFLATE text/html 
        AddOutputFilterByType DEFLATE text/plain 
        AddOutputFilterByType DEFLATE text/x-component 
        AddOutputFilterByType DEFLATE text/xml
    </IfModule>

</IfModule>

After I’ve uploaded the saved version on to the server and rerun a website speed test, this doesn’t seem to make a difference.

So if someone could give me a bit of insight on this, that would be great.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.