You may have noticed in Google’s PageSpeed Insights that some websites are flagged up for not enabling compression, as seen below.

What exactly is Gzip compression?

The simple’s way to explain Gzip compression is by imagining you ordered a new dinner table. Once it arrives it will be packaged and dismantled, you’ll be required to set the table up yourself. Gzip compression works in a similar way but with computer bytes, the server will compress steams of bytes such as spacing within HTML, CSS or JS files and send them across the web. Once the files are downloaded by your browser, the browser will uncompress these files. This simple feature can yield significant page speed improvements and reduction to page size.

Gzip compression works in a similar way but with computer bytes, the server will compress streams of bytes such as spacing within HTML, CSS or JS files and send them across the web. Once the files are downloaded by your browser, the browser will uncompress these files.

This simple feature can yield significant page speed improvements and reduction to page size which can help improve SEO performance.

Enabling Gzip Compression

.htaccess Code:

AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/opentype
# For Olders Browsers Which Can't Handle Compression
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html