How to Enable GZIP Compression in WordPress?

07:37
73
-
Like this post? Rate it:
Related CMS:

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.

By enabling GZIP compression, you are directing the server to wrap all the images, CSS and JavaScript components before transferring the data to the visitors' web browser window. This technique can go a long way to serve the requested web page significantly quicker.

Here are the steps that you need to perform to enable GZIP compression in WordPress.

Enable GZIP Compression Using .htaccess File:

Step 1: Login to your Hosting Control Panel

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.

Step 2: Open File Manager

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.

Step 3: Browse to the Root Folder

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.

Step 4: Open .htaccess File

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.

Step 5: Append the Below Given Code

Scroll down to the end of the file and copy+paste the below given code snippet.

<code>

## 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

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript

## ENABLE GZIP COMPRESSION ##

</code>

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.

Alternative Method Using a Plugin

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.

Conclusion:

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.

RSS
No comments yet. Be the first to add a comment!
Loading...