Whether it is a static html or php website or a feature rich WordPress enabling compression is always a smart move. It speed up your website by sending the files in gzip to your browser.
There are several benefits to enable Gzip compression, because it’s the most popular way to load your site faster by reducing more than 70% of your web page.
It reduces Server response time and also reduces volume of data sent by the server to the requesting web browser because it uses compressed during page transfer.
How is this magic method used?
Its quite simple if you know your server and files on it, basically if you know where the root directory of your website is and a file called .htaccess or if its not there create a “.htaccess” file. If you upload it and its named .htaccess.txt remove the .txt extension, and you good to go.
Add the following code in WordPress .htaccess file of your website
# BEGIN GZIP COMPRESSION
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_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
# END GZIP COMPRESSION
To test your new swifter website visit free the bot or check gzip compression and enter your url and see the results but also recheck that everything is ok on your website because (things do go wrong (sometimes)).
You will notice a massive PageSpeed increase thus future proofing your website against further Google updates.
Visit Google PageSpeed Insights before and after to see the results.
View more website management tips