Enable Gzip on Apache

Edit .htaccess file

Enabling Gzip in Apache is very easy, and will save us bandwidth transfer and also takes less time to load the pages.

Gzip is enabled by adding the following code

<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.*

to a file called .htaccess on your web server document_root.

Save the file and then refresh your webpage.

To check your server to see if it is sending out compressed data, go to this site.