How to enable GZIP compression for your WordPress site
“Slow load time on WordPress site sucks”isn’t? everyone keeps a wish to achieve the good rank of a site but, somehow they face a roadblock. In this article, we will help you to enable GZIP compression for your WordPress website. This trouble arises due to the size of your pages on your website.
- The Unoptimized images are common culprits for the slow site. Size of images should be under 100kb.
- Code density, sometimes Inefficient code exist.
- External Embedded Media.
It’s essential, that you optimize your site for performance at all times.
As a website owner, you probably understand the importance of website speed and page loading time, In fact, loading speed is so important. If web pages quickly available to visitors it will influence your bounce rate, user experience, ranking and much more.
Navigate your site to run at peak efficiency, take a step towards GZIP compression an effective way to make your site load faster, also called HTTP or browser compression.
The visitors’ web browser automatically decompress the page compression and decompression, which only take a fraction of a second. Compression is the process of encoding information using fewer bits
- Compress 100kB file to 10KB.
- Reduces Page sizes & Increase page speed.
- Enable compression warning in Google PageSpeed Insights.
- Enable GZIP compression warning in GTmetrix
How to Enable GZIP Compression
1Enable Gzip Compression in WordPress via .htaccess
To enable Gzip Compression in WordPress via .htaccess, you need to Log into your cPanel and follow the following steps.
- Under file section, select file manager menu.
- Check the checkbox show hidden files and click Go.
- Under public_html folder of your website, find and edit the file called .htaccess.
- Paste the following code into .htaccess file at the end of your existing content.
- GZIP Compression – Copy and Paste the following code in WordPress .htaccess file of your website.
The instructions and code above will work on Apache. If they are not working there is another way that may work for you. If the above code did not seem to work, remove it from your .htaccess file and try this one instead.
- DEFLATE Compression – Copy and Paste the following code in WordPress .htaccess file of your website.
2Enable Gzip Compression with WordPress plugin
Here, is some sort of plugin solution to set up Gzip compression. One of the easiest way using a plugin that supports enabling GZIP.
- “WP HTTP Compression Plugin“, This plugin allows you to output the pages in Gzip compressed format, allows your WordPress blog to output pages compressed in gzip. HTTP compression generally means a 60-80% REDUCTION in the size of your pages (broadband usage) as well as an INCREASE in download speeds of 3x to 4x. Download, install and activate ⇒ https://wordpress.org/plugins/wp-http-compression
- “WP Super Cache“, Another plugin option which generates static HTML files from your dynamic WordPress blog. After an HTML file is generated your web server will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP scripts, You can find an option to Compress pages so they’re served more quickly to visitors. Download, install and activate ⇒ https://wordpress.org/plugins/wp-super-cache/
- “WP Rocket“, It also helps to boost the performance of its site without effort and improve the user experience. Furthermore, support is effective and responsive! but also comes with compression built in. Download, install ⇒ https://wp-rocket.me/
3Enable Gzip Compression on NGINX