Enable gzip compression : Speed Up WordPress Site

Enabling GZip Compression To Increase Site Speed.

how-to-speed-up-your-wordpress-site-with-gzip-compression

What exactly is GZip Compression?

GZip is an algorithm that compresses the information/data on your site, server-side, prior to sending it to the user, where the browser then decompresses the data locally before rendering it for the user

It should be noted that this is really a function only modern web browsers can utilize. It’s constructed inside the browser itself. If a large portion of your visitors still comes from older web browsers, you won’t be able to use this feature unfortunately.

 

How Does GZip Compression Work?

In terms of the browser, it would function like this. The user goes to your website (e. g. http://yoursite.com/wow.html) which behind-the-scenes sends a GET request to the server for wow.html. The server accepts and processes your own request and responds by sending back wow.html and all of the other files it references to your browser.

 

Where’s the problem? Why bother using compression?

Well, in this day and age, it’s pretty popular to have a bunch of Javascript as well as various CSS stylesheets downloading with the HTML file. This could bloat GET requests such as the example mentioned above. Sure, wow.html itself might be 5kb, but with all of the referenced files needed to render the actual page, might push the entire download for that page to100kb!

Also keep in mind, a growing percent of people that might be checking your website on their mobile device having a terrible connection speed. The 100kb would be an eternity for them. GZip compresses all the files that the browser demands before sending them to the browser, the internet browser then decompresses the documents and renders the web page. So that 100kb download may potentially be dropped to 10kb for the same files! Now you see the greatness of using GZip!

 

Why is GZip Compression Essential?

Okay, when if the things mentioned above weren’t enough, how about it also assists your SEO ranking?

How?

Because it boosts your web page speed. And if you did not already know, Google‘s ranking formula takes into account how fast the pages on your site load, this in turn helps your position per page and positioning on Google Search Results. And we are very mindful that more than half of the majority of website traffic is organic and comes from search engines.

 

And most importantly, you will be keeping your audience happy. Nobody likes waiting forever for any site no matter how awesome the website is.  The truth is most people will not wait for more than three secs for a page to start responding.

 

How to Enable GZip Compression in WordPress

You’ve read the advantages and you want to make your WordPress site travel with GZip compression.  All it takes are 4 simple steps!

 

1 . Log in for your WordPress admin.

2 . Go to: http://yoursite.com/wp-admin/options.php

3 . Scroll down to gzipcompression and change the value in the field from 0 to 1. This value sets GZip compression to “true” in WordPress.

4 . Click Save.
Please note that you have to confirm that gzip has being enabled through your hosting by reaching your support team. If it is enabled, you would also need to update your .htaccess file especially if you are using an Apache server.

Please, PERFORM KEEP A BACKUP of the .htaccess file before you mess with it!!!

If you are used to getting your hands dirty and adjusting files via FTP, then, you know how to proceed.

If you would prefer to stay within your WordPress backend, then this free plugin enables you to simply edit your .htaccess file through wp-admin: WP Htaccess Editor

 

A typical WordPress. htaccess document should look like this:

[dt_code]
# BEGIN WordPress


RewriteEngine Upon

RewriteBase /

RewriteRule ^index\. php$ - [L]

RewriteCond % REQUEST_FILENAME! -f

RewriteCond % REQUEST_FILENAME! -d

RewriteRule. /index. php [L]

 

# END Wp
[/dt_code]

 

To enable gzip compression, just add the following at the end of the file:

 

[dt_code]
# compress textual content, html, javascript, css, xml:

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType FLATTEN text/xml

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType FLATTEN application/rss+xml

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript

AddType x-font/otf. otf

AddType x-font/ttf. ttf

AddType x-font/eot. eot

AddType x-font/woff. woff

AddType image/x-icon. ico

AddType image/png. png
[/dt_code]

 

And that’s it!

You can test the result directly with your browser developer’s tool (inspector), or by using some tools on the internet like: HTTP Data compression Test. Simply enter your site’s WEB ADDRESS, and it will tell you if it is really gzipped, and if it is, you will notice the impressive compression ratio.

how-to-speed-up-your-wordpress-site-with-gzip-compression

That’s it! Your WordPress install is actually setup to take advantage of GZip compression. As always if you have any queries or comments, please post them below. Thanks for reading. Hopefully, this was useful!

Leave a Comment: