enable compression to improve SEO

We often get irritated when certain websites take a much longer time than others to load in our browser. This is a problem that we all have faced in some website or the other, and as a result, we have vowed never to go back to that site.

The Internet user is impatient, and they don’t like to wait for a single second, and you need to capitalize on this point. Reducing the time taken by your site to load on to the browser will help you improve your SEO ranking, and it will definitely enhance the user experience.

Before we start on how to reduce the time and what should be done, let us first understand what happens when we try to load a web page. These are the following steps that take place whenever someone tries to load a web page –

  1. The website’s server receives the request from your browser
  2. That particular page is sent to your browser after the server finds the page
  3. That page is downloaded by your browser and is displayed on your screen

The time taken by each step summed up is the total time taken by your site to load on to someone’s browser. When we talk about reducing the time, we talk about reducing the time taken by these steps. This is not so simple after all, with all the images and Java Scripts and other links and files in, the loading time does get affected. But you need not worry anymore; this article has got you covered.

The Outlook

There are various ways to shorten the time lag of your website. Today we are going to discuss the most essential method that is compressing your files. Compressing is an efficient and effective way to decrease the loading time of your website. The files compressed are changed into zip format, which is smaller in size so they can be transferred from the server to you’re the browsers faster than normal files. You don’t have to worry about the browser of the user as all the browsers available in the market can actually unzip a file and open it in no time. Way to go!

Compression

The usual question? What is compression? Compression is the method of compressing files so that their size becomes, which is eventually easier to transfer on the web. To go by the meaning of the word compression means to compress, and, in this scenario, we’ll be compressing files. Technically compression works by scanning the available data, then it finds all the repetitive data that is present in the file and replaces those repetitive files with an identifier that is actually less in size than the original data. When this file is uncompressed, then the duplicate data having the identifier gets replaced with the original data.

How and Why Does Compression Matter in SEO?

Compression is related to SEO because the ultimate motive of compression is to increase the speed of transfer of files, and speed does matter in SEO. Hence, compression is deeply related to SEO.


Search engines like google always try to suggest websites that are faster in loading and have accurate information. If this load time is less for your website, then Google is more likely to recommend your website provided that your information is accurate, and the site is up to date. This is how compression can improve your SEO rankings.

Enabling Compression

The procedure to enable compression depends on your server and how it actually works. In this article, we’ll go through the methods of implementing compression in the majority of the servers.

The steps are as follows on various servers –

Compression through .htaccess

A significant number of people use WordPress for their website management. Hence, for most of the people, it is just adding the codes to their .htaccess on their server or using a simple plugin for this matter who uses WordPress. Another way to enable compression is to use the file manager and do it externally. After adding the codes, save and refresh your page.

Following are the codes that you need to add to your .htaccess file for enabling compression –


mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

Compression on Apache Servers

Apache serevers have been improvised and these codes work with the new servers –
Delete the existing codes and add this code to your server

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

People using the deflate will have the advantage because gzip is not primarily installed but deflate is

Compressing files on NGINX server


In your server gzip is enabled by default. We need to find this setting first and then add our code to the existing settings for optimum results.

Follow the steps to enable compression –

  1. Open the main configuration file of NGINX server in your choice of text editor.
  2. Search for gzip settings
  3. Uncomment the settings
  4. Add: gzip_min_length 256;
  5. Go to gzip_types and add: application/vnd.ms-fontobject application/x-font-ttf
    font/opentype image/svg+xml image/x-icon
  6. After making all the necessary changes, your gzip settings file is going to look like this –
  7. Save and close the file
  8. Restart NGINX to enable the changes
##
# undefined Settings
#
#
gzip on;
gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;

Above mentioned are the procedure for updating your setting to get the optimum benefit out of Compression.

Trying Out the Compression

Now that you’ve worked so hard, added all the codes whichever applies to your server, it’s time to test your site. Open WooRank and run a test. This will tell you if your files are compressed or not.

All the Best!