<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>
Here's a simple .htaccess script to enable gzip compression if you're on an Apache webserver.
gzip compression compresses the code inside html, css, js, php files on the server before sending them to the visitor. This is good for a number of reasons. Faster load time, and less overhead on the server that sends these files to the user.
checkgzipcompression.com is a helpful tool to see if gzip compression is working correctly.
On top of compressing these files it is also a good idea to Leverage Browser Caching to force the browser to remember assets it has already downloaded.