Additionally, Google warns for sites that are devoid of compression enabled. When the Gzip Compression is allowed in your WordPress with a plugin, there will be a data reduction in the range of 60%-80% of your website. The present article discusses how to enable Gzip compression into your WordPress website by editing the .htaccess file:
The working mechanism of Gzip Compression:
The Gzip compression utilizes an algorithm that manages repetitive strings in one place only as an alternative to saving those strings repeatedly. Moreover, it controls such strings and their location values when compressing and recovering data from compressed files.
Generally, Gzip compression works well with stylesheets as well as web pages. This is because every such resource file contains several repeated strings. Due to its compression mechanism, Gzip can decrease the file size by 80 to 90%.
Steps to enable Gzip compression a WordPress website through .htaccess file
- Step-1: Firstly, login into your cPanel
using your username and password.
- Step-2: Now click on File Manager in the Files section.
- Step-3: Find out the .htaccess file present in the public_html directory. Alternatively, you can use the Filezilla client application to find out the .htaccess file.
- Step-4: Now right-click the .htaccess
file and then click on ‘Edit.’ This will show the Edit menu as it popped up. Now click on the ‘Edit.’
- Step-5: Include the below line of codes at the bottom of your .htaccess
If your website is hosted on an Nginx server, include the below lines of codes:
- Step-6: To save all your changes, click on ‘Save Changes.’
- Step-7: Use the W3 Total Cache plugin:
There are WordPress plugins accessible to let you enable the Gzip compression to your website. The W3 Total Cache is one of the widely used and famous caching plugins on WordPress. With the help of this plugin, it is easy to enable Gzip compression.
Go to the settings page to enable Gzip compression through the W3 Total Cache. Next, enable the HTTP compression option and finally click on ‘Save Changes.’