Speed Up Your Site With GZIP Compression
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.
- 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.
- 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.
- Click on the .htaccess file to highlight it.
- Then click on ‘Code Editor’ and then on Edit.
- In the ‘Code Editor’ you may see some WordPress code, don’t touch it.
- 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.
- Click on Save Changes” and you’re good to go.
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
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