.htaccess – gzip output content

GZIP compression is used for compressing the content of the web pages by the server before the content (text & images) get passed to the browser. The browser takes this input and decompresses the content before delivering it to site users.

Compressing the content of the pages makes the page size small which in turn will have a positive & significant impact on the page loading. There is a misconception that the larger bandwidth availability or lesser file size is what is needed for faster page loading, which is not.

In .htaccess: to gzip output before delivering the content

<ifmodule mod_headers.c>
<ifmodule mod_deflate.c>

# Compress some text file types
AddOutputFilterByType DEFLATE text/html text/css text/xml application/x-javascript

# Deactivate compression for buggy browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

</ifmodule>
</ifmodule>

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Written by kurinchiblogger


Website:

Leave a Reply

Your email address will not be published. Required fields are marked *

Read previous post:
Apache server for Programmers – start, stop, restart, reload

If you are a beginner into Linux, there are chances that you might research on the web to see why...

Close