Page load speed is a crucial factor that should never be overlooked. Quick response time not only improves the user experience, but can also play a significant role in promoting the search engine visibility for your website.
Better page load speed results in higher page rank - which is an essential aspect to attract organic traffic from Google, Bing and Yahoo search results.
To achieve higher page load speed, it is crucial to decrease the size of your web page. GZIP compression is aimed at reducing the overall size of web pages by binding together all the web objects present on a particular page. It reduces the size of data being transferred between your server and the visitors’ browsers.
Here are the steps that you need to perform to enable GZIP compression in WordPress.
Your hosting service provider must have given you the credentials to manage your web hosting account with the help of a control panel interface. cPanel, DirectAdmin and Plesk are a few of the most popular control panels available with different hosting services.
We will be using cPanel to provide the demo in this tutorial, but you can perform the same activity with other control panel interfaces as well.
So open a web browser program and type your cPanel URL in the address bar. Enter the username/password combination to login to cPanel dashboard.
cPanel has an inbuilt File Manager tool for accessing the files stored in different directories. From the cPanel dashboard, scroll down to the 'Files' section and click to open File Manager utility.
A new window will pop up. It will prompt you to choose the directory which you would like to browse. The .htaccess file resides under the 'Root' directory(public.html). Select the radio button for 'Web Root' and tick the check-box for 'Show Hidden Files'. Now click on the 'Go' button.
You can see the entire directory structure on the left sided pane, while the right hand side pane is used to show the files stored under the selected directory.
Search for the .htaccess file on the right pane. Select the file and click on the 'Edit' link. It will open up the file in a text editor.
Scroll down to the end of the file and copy+paste the below given code snippet.
## ENABLE GZIP COMPRESSION ##
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
## ENABLE GZIP COMPRESSION ##
Now click on the ‘Save Changes’ button at the top right corner. Close the text editor window to return to the File Manager interface.
That's all you need to do to enable GZIP compression on your WordPress website. Test the performance of your website by using any online website performance optimizer tool and you should ideally notice a great deal of improvement in page load speed.
In case you are not too web-savvy and afraid of making changes to the hosting environment, there is an alternative way to enable GZIP compression using a relevant plugin.
WordPress plugin repository has several GZIP compression plugins available for free of cost. GZip Ninja, WP GZip Compression and Force-gzip are a few of the most popular choices. All you need to do is to install one of these plugins and activate GZIP compression from the plugin settings.
If you are looking to enable GZIP compression on your WordPress website, you will find this tutorial to be useful. We have discussed how to enable GZIP compression by modifying the 'htaccess file. Besides, you can also make use of a GZIP compression plugin to achieve the desired outcome. Rest assured, you will observe lightening fast website performance after enabling GZIP compression.