One place for hosting & domains


      Speed Up Your WordPress Website with Gzip Compression

      Keeping your website running at top speed is essential. A speedy website can provide a huge boost to your site’s user experience, search engine visibility, and improve your professionalism and reliability.


      Gzip compression is one popular method to speed up your site. While the term may sound technical, the basic concept isn’t too complicated. What’s more, enabling Gzip compression on your WordPress site is surprisingly easy. Let’s find out more!

      An Introduction to Gzip Compression

      compressing the CSS stylesheet with Gzip

      As your site expands, many of its files grow in size as well. This is a natural result of adding more content, plugins, themes, and custom code to your site. All of that new data has to be stored somewhere.

      The downside of larger files is that they often take more time to load when your pages are accessed. This means your visitors will end up waiting longer to view your content — which is never a good thing. To deal with this problem, you need to find a way to make your site’s files smaller without losing any important information.

      This is exactly what Gzip compression does. It reduces the size of your files by ‘compressing’ them, removing unnecessary characters, and reorganizing data more efficiently.

      If you’ve ever ‘zipped’ a folder to make it smaller, this is a similar concept. Gzip compression can reduce the overall size of your pages by up to 70%, and nothing crucial is lost in the process.

      Get Content Delivered Straight to Your Inbox

      Subscribe to our blog and receive great content just like this delivered straight to your inbox.

      How to Enable Gzip Compression on Your WordPress Site (2 Methods)

      There are a lot of ways to speed up your WordPress site. For example, choosing an optimized hosting plan is key. However, Gzip compression can improve your page speeds even further, so it’s worth implementing.

      Below, we’ll show you two ways to get started with Gzip compression. Keep in mind that the first thing you’ll want to do is make sure you have a recent backup of your site in place as a safety precaution. Then you can read through both methods and choose the one you prefer!

      Method 1: Use a Plugin

      You may struggle to find a quality plugin exclusively designed to implement Gzip compression. Fortunately, you don’t need one. Many speed optimization plugins include an option for Gzip compression as a part of their feature sets.

      For a perfect example, check out WP Super Cache:

      WP Super Cache WordPress plugin

      This plugin is primarily a caching solution, which is another smart way to speed up your WordPress site. However, it also enables you to compress your files.

      After installing and activating the plugin, you’ll need to navigate to Settings > WP Super Cache and switch over to the Advanced tab:

      enabling Gzip compression in the WP Super Cache WordPress plugin

      Find the option labeled Compress pages so they’re served more quickly to visitors, and check the box next to it. Then click on the Update Status button to save your changes.

      That’s all you need to do — the plugin will now implement Gzip compression automatically!

      2. Modify Your .htaccess File

      While the above technique is the simplest way of enabling Gzip compression on your WordPress site, some users will be more interested in an alternative method. For instance, if you’re trying to limit the number of plugins you install on your site, you might prefer to implement Gzip compression manually.

      To do this, you’ll need to use the Secure File Transfer Protocol (SFTP). It enables you to directly access (and make changes to) your site’s files.

      If you’ve never used SFTP before, you’ll first want to install a suitable client, such as FileZilla (and brush up on your SFTP skills). Then you’ll need to establish a connection to your site using your hosting credentials.

      Once you have FileZilla set up, it should look something like this:

      editing files in an FTP client

      In the top right quadrant, find the folder named after your website’s domain and select it. Then, in the bottom right quadrant, look for the file called .htaccess. This is one of your site’s core files, so you should always be very careful when making changes to it:

      enabling Gzip compression by editing CSS stylesheet in WordPress

      Right-click on the .htaccess file and select Download to save it to your computer. Then open the file in any text editor (such as Notepad), and paste in the following code:

      <IfModule mod_deflate.c>
      # Compress HTML, CSS, JavaScript, Text, XML and fonts
      AddOutputFilterByType DEFLATE application/javascript
      AddOutputFilterByType DEFLATE application/rss+xml
      AddOutputFilterByType DEFLATE application/
      AddOutputFilterByType DEFLATE application/x-font
      AddOutputFilterByType DEFLATE application/x-font-opentype
      AddOutputFilterByType DEFLATE application/x-font-otf
      AddOutputFilterByType DEFLATE application/x-font-truetype
      AddOutputFilterByType DEFLATE application/x-font-ttf
      AddOutputFilterByType DEFLATE application/x-javascript
      AddOutputFilterByType DEFLATE application/xhtml+xml
      AddOutputFilterByType DEFLATE application/xml
      AddOutputFilterByType DEFLATE font/opentype
      AddOutputFilterByType DEFLATE font/otf
      AddOutputFilterByType DEFLATE font/ttf
      AddOutputFilterByType DEFLATE image/svg+xml
      AddOutputFilterByType DEFLATE image/x-icon
      AddOutputFilterByType DEFLATE text/css
      AddOutputFilterByType DEFLATE text/html
      AddOutputFilterByType DEFLATE text/javascript
      AddOutputFilterByType DEFLATE text/plain
      AddOutputFilterByType DEFLATE text/xml
      # Remove browser bugs (only needed for really old browsers)
      BrowserMatch ^Mozilla/4 gzip-only-text/html
      BrowserMatch ^Mozilla/4\.0[678] no-gzip
      BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
      Header append Vary User-Agent

      Don’t forget to save your changes to the file. After that, you can re-upload it to your site by copying and pasting it back into your website’s root folder (or simply dragging it there from your computer). Now you’ve enabled Gzip compression on your WordPress website manually!

      Note that this method is for websites with Apache servers. If your site runs on NGINX, we recommend checking out this tutorial on enabling Gzip compression with NGINX.

      Speed Up Your WordPress Site with Gzip Compression

      There are a lot of ways to make sure your WordPress site runs fast and efficiently. For example, you’ll want to choose an optimized hosting plan with a reputation for speed. After that, you can make plenty of smaller tweaks to maximize your site’s performance, such as using Gzip compression to reduce file sizes.

      Do More, Faster, with DreamPress

      DreamPress’ automatic updates, caching, and strong security defenses take WordPress management off your hands so you can focus on your website.

      shared hosting

      Source link