You might have heard some talk about how compressing your web pages helps with your site’s SEO, but how does it help and how can you use it on your site? This article will provide you with some details on what file compression is and why it’s essential to the process of optimizing your site.

What is File Compression and Why is it Important for SEO?


When you click on a link and a web page comes up in your browser, there are a few steps that take place in order for that page to become visible to you. First, your browser (internet explorer, firefox, etc) sends a request to the webserver (the computer where a website’s files are stored). If the browser and the web server were people, that request would sound something like this:

“Hey web server for ‘www.example.com,’ this is Joe’s internet browser. Joe is asking for the home page ‘www.example.com,’ please send me the file for that page so that I can show it to Joe.”

The next step would be the webserver searching for the file ‘http://www.example.com,’ reading it and responding by sending that page to Joe’s browser. Once Joe’s browser receives the page, Joe would be able to view the page by looking at his computer screen.

The faster these steps take place, the faster the page is loaded into Joe’s browser and the less time Joe has to wait for that page to “load.” Web page load time is becoming more and more important to search engines when it comes to determining how well optimized a website is. This is because sites with longer load times require users to wait longer while sites with faster load times require less waiting time.

Since web users like to get what they want quickly, this means that the faster your site loads, the more user-friendly it will be, and the more the search engines will like it. The problem is that the larger your web pages are, the more time it takes the webserver to read the information in the file and send it over to the browser so that the page can be viewed.

This means Joe has to wait longer for the page to load, and since Joe (like the rest of us) does not like waiting, there’s a chance he’ll just abandon the process and move on to a site that will give him what he wants faster. However, with file compression like GZIP, you can reduce the size of your web page files by up to 70%, which equals faster loading time and a happier Joe…which in the end, equals better status with the search engines.

You accomplish this by setting up a “zipped” or compressed version of the file on your server-side, which is smaller and therefore takes less time to send over to your user’s browser. The file is then decompressed or “unpacked” quickly on the user’s side, resulting in a faster file transfer.

Options for File Compression: Deflate or GZIP

Your two options for file compression are Deflate and GZIP. Deflate is an option that comes automatically with the Apache server and which is simple to set up. GZIP on the other hand needs to be installed and requires a bit more work to install. However, GZIP does achieve a higher compression rate and therefore, might be a better choice if your website uses pages that have a lot of images or large file sizes.

 On the other hand, if your site has over 1,000 unique visitors a day, deflate is actually a better selection because it requires much less energy to compress files, which means your high volume of visitors won’t slow down your site due to the increase in GZIP compression.  

Setting up File Compression with Deflate

Setting up file compression for your website will depend on which type of server you’re using for your website. Most likely, you’ll be using Apache, which means you can enable compression by adding a few deflate codes to your .htaccess file. This file can be found by accessing your website's control and command (CNC) panel and is located in your main directory. For example, if your site was http://www.example.com, your .htaccess file would be in this location:

http://www.example.com/.htaccess

Just keep in mind that you won’t be able to view your .htaccess file simply by typing this URL into your browser. You have to access the file location through your CNC panel. Then, you simply add the codes to your .htaccess file which will compress your site’s files by types. For example, if you want to compress all of the .txt and HTML files on your site:

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/html

-Other codes can be added to the .htaccess file to compress your .xml files:

AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType DEFLATE application/rss+xml

-Finally, the following codes can be added to compress your .css and javascript:

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript

-The other option is to select only certain file types on your website using the following command in your .htaccess file:

SetOutputFilter DEFLATE

-Notice here that you’re choosing to compress all html files (the * character is a wild card code that stands for “all”). You could also choose to only compress .xml files and .css files:

SetOutputFilter DEFLATE

If you don’t care to follow the above instructions for compressing your files or if you opt for using GZIP, you can hire a web programmer to take care of it. The job will take less than an hour and it’s usually best if you outsource this job along with a few other small web programming tasks such as optimizing your meta data or creating a robots.txt file.

Verify Your File Compression Codes

 Once you have added the compression codes to your .htaccess (or had your web programmer do it), you can verify that the compression codes are working by simply type your URL into our site checking tool. Here, you’ll also find information about how well your site is optimized in regard to: metadata, keyword density, incoming links, and much more.

Thank you for reading. Continue your journey of learning through our site SEOSiteCheckUp.com. Don’t forget to take advantage of our free SEO tools!