Gzip compression without plugins in WordPress
One of the methods to improve the response times of our blog or website is to enable Gzip compression . By enabling this option we get the data to be compressed with Gzip before being sent to the client, so less data is transferred and this is why less time is needed for the transfer and therefore improves the response time. This option also helps us consume less bandwidth.
The negative side of Gzip compression is taken by the server that will need to use more resources (CPU and RAM) to be able to compress each request. This resource can be a problem in blogs or web pages with many visits hosted on small servers but as a rule having Gzip compression enabled should not be a problem.
In this article we will show how to enable Gzip compression in our blog without installing any plugin . This is an interesting option for those of us who don’t like to add plugins, since in my opinion the fewer plugins the better, since it will give us less problems in the long run.
Methods to enable Gzip compression in WordPress without plugins:
Using an .htaccess file
This is a very simple method, it only has the requirement that our web server has the module that handles Gzip compression, for example in Apache it is
mod_deflate . As it is almost certain that your server is Apache and already comes by default with this module enabled, this method should work for most users. You must add the following lines to the
From the advanced WordPress options.
If for some strange reason the previous method does not work correctly, you can try this second method. You have to access the advanced WordPress options, which are a bit hidden. The first thing is to access the WordPress control panel with your username and password.
Once identified we access the link:
http://www.miblog.com/wp-admin/options.php and several options will be listed, you have to look for one with the name gzipcompression and change the value 0 to 1 and save the changes With this, compression should already be enabled.
Which method is better than both?
The difference between the first method (.htaccess) and the second (advanced options) is that in the first method the server itself is responsible for compression (Apache for example) and in the second method WordPress itself is responsible for compression (using PHP code). Personally, the .htaccess method seems more efficient and “clean.”