HomeArticlesSpeed Up Your Site With GZIP Compression

Speed Up Your Site With GZIP Compression

Speed Up Your Site With GZIP Compression

Speed Up Your Site With GZIP Compression GZIP compression is a popular method used to reduce the size of web files — including HTML, CSS, PHP, and JavaScript. That way, your site speed will improve, since visitors will download the compressed data instead of the full-sized files. What’s more, Google includes page loading time as one of the factors in its ranking algorithm. The faster your site loads – the higher you’ll rank.

Considering the benefits of GZIP compression, it’s important to check whether your site has enabled it or not. You can use the Check GZIP Compression tool to do so. If GZIP is already activated, the tool will show you the page size before and after the optimization. If it’s not, an error message will appear. Slow WordPress sites are bad for business. Luckily, optimizing them is easier than you think. Using GZIP compression requires minimum effort and can be effective in speeding up some WordPress sites.

Enabling GZIP is done by simply adding a small amount of code into your site’s .htaccess file. Enabling it shouldn’t take more than 5 minutes of your time. Your site may already be compressed using GZIP compression or another compression technology. So first we’re going to run a test to find out.

HTTP Compression Test

First of all, check whether your WordPress needs optimization. Go to this page: http://www.whatsmyip.org/http-compression-test/.

Enable GZIP Compression

Enabling Gzip compression is really easy using these step-by-step instructions:

  • Go to your Cpanel and click on ‘File manager’ – There might be a popup where you need to check the ‘show hidden files checkbox’. If this isn’t the case, go to Settings in the upper-right corner once inside the file manager and check it manually.
  • Navigate to the root of your website

The easiest way to enable GZIP compression in your WordPress site is to install a plugin. It will be a lot easier and safer than modifying the .htaccess file.

There are a lot of plugin choices available, but we have singled out these three plugins based on their features and ease of use:

  • WP-Optimize — an all-in-one solution to boost your website performance. The plugin will enable GZIP compression and web caching. In addition to that, it will clean unnecessary files on your website. This tool can even optimize images to free up more space!
  • Hummingbird — you have more freedom to choose what aspects you want to optimize. GZIP compression, minification, and lazy load offscreen images are some of its main features.
  • WP Fastest Cache — WP Fastest Cache combines its caching prowess with GZIP compression to make your page fast and lightweight. This tool can also automatically disable emojis and optimize every single post.
  • Adding Code to the .htaccess File

    This method is quite technical, so it’s more suitable for advanced users. However, anyone can do it as long as they are careful.

    Before we continue, remember that you should always back up your .htaccess file first in case something goes wrong.

    1. You will need to download an FTP client, like Filezilla, to locate the .htaccess file. It is usually placed in the public_html directory of your website.
    2. Find the htaccess file – If you’ve followed the steps above (e.g. checked the show hidden files box) and can’t find the htaccess file you can create a new one. To do that go to the file menu and create a new file called .htaccess. Missing the htaccess file is highly unlikely if you already have WordPress installed because WordPress creates the .htaccess file automatically for its permalinks.
    3. Click on the .htaccess file to highlight it.
    4. Then click on ‘Code Editor’ and then on Edit.
    5. In the ‘Code Editor’ you may see some WordPress code, don’t touch it.
    6. Copy and paste the code below into your .htaccess file.  Make sure not to disturb any of the existing .htaccess code if there is any.
    7. Click on Save Changes” and you’re good to go.

Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# compress text, html, javascript, css, xml:
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/xjavascript
AddType xfont/otf .otf
AddType xfont/ttf .ttf
AddType xfont/eot .eot
AddType xfont/woff .woff
AddType image/xicon .ico
AddType image/png .png

 

RELATED ARTICLES

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

- Advertisment -

Most Popular

Recent Comments