Cheap Drupal 8.0.5 Hosting Recommendation
0 0
Read Time:5 Minute, 36 Second

How Does WordPress GZIP Compression Work?

A mashup of computer languages—HTML, CSS, and JavaScript—are used by almost all modern websites. Reducing them to their most basic form, they’re essentially text files.

When users go to your website, their browsers download these text files and will begin rendering the website according to the code contained within these files. These codes are then translated to something readable and understandable to the average human.

As machines, browsers don’t require all that extra whitespace and extra formatting used to improve readability. As long as the browser can analyze code content, it can be written in one long block of text.

In general, WordPress GZIP compression takes away the formatting that is mainly used for human understanding. Reducing the length of code also reduces the size of the file containing it.

How to Enable WordPress GZIP Compression

WordPress GZIP compression is actually something that you need to enable on the server side—not WordPress.

For other web hosts, it’s up to you to enable WordPress GZIP compression.

Based on the plugins you’re already using (or the web host where your website is stored), it’s possible that WordPress GZIP compression is already enabled. You can easily check to determine this by running your domain name through the GZIP compression checker.

If you’ve determined that WordPress GZIP compression is not yet enabled, there are multiple methods to get started—with different options for experienced backend web development and newbie WordPress users, alike.

1.     Enabling WordPress GZIP Compression via .htaccess

This is the most common way to enable WordPress GZIP compression.

However, this particular method involves the possibility that you might break something. After all, .htaccess is a very sensitive server file, and one wrong move can mess up your whole website.

To reduce the likelihood of breaking your WordPress website, be sure to make a copy of the original file before making any changes. And back up your WordPress website!

Once you’ve covered all your bases, it’s time to get rolling.

The .htaccess file should be in the root folder of your website. This file, however, is usually hidden by default on both the remote server and your own machine, if you copy it.

The best way is to access the file is through FTP. Alternatively, you can use another admin interface or cPanel.

To enable WordPress GZIP compression in your FTP client, force hidden files to show.

Once you locate the .htaccess file, start editing it. Or, to be safe, download the file on your computer and first make changes on your own hard drive. The file is likely also hidden by default on your own machine, so force hidden files to show.

Add the following code, sourced from GTmetrix, either inside or outside # BEGIN WordPress and # END WordPress (it doesn’t matter where):

# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
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

Save the file and replace your original .htaccess file. Then, run your website through the aforementioned GZIP Compression checker tool to make sure that you were successful.

2. Contact Your Web Host

If you’re not comfortable making changes to your website files, it’ll be easier to ask your web host to enable WordPress GZIP compression for you.

In general, most web hosts will be willing to assist you with this query when you reach out to their customer support teams.

3. Enable WordPress GZIP Compression with a Plugin

Of course, if you’re using WordPress, there’s always a plugin that can make the job easier. The caveat? More plugins means more potential security vulnerabilities—and space on your server.

Regardless, these plugins can help you to easily enable WordPress GZIP compression.

WP ROCKET

WP Rocket is a caching plugin that helps WordPress sites load faster in just few clicks. Upon activation, WP Rocket adds GZIP compression rules in your .htaccess file using the mod_deflate module.

CHECK AND ENABLE GZIP COMPRESSION

Just as the name “Check and Enable GZIP Compression” suggests, this plugin is built for that same purpose. It’s simple: the plugin checks if your WordPress site has GZIP compression enabled and it will enable GZIP compression if it’s not yet done. This plugin has over 20,000 active users.

W3 TOTAL CACHE

W3 Total Cache is considered to be the number one WordPress caching plugin. A potential issue: WordPress newbies can easily break their website when using W3 Total Cache without proper configuration. If you know what you’re doing, you can also enable HTTP compression by going to the browser cache, and checking the box for HTTP (GZIP) compression.

WP SUPER CACHE

WP Super Cache is another WordPress cache plugin that offers the option to compress code. To enable WordPress GZIP compression using WP Super Cache, go to the WordPress dashboard > WP Super Cache > Advanced > check the box for Compress pages so they’re served more quickly to visitors.

4. Enable GZIP on NGINX

If you’re running on NGINX, look for your nginx.conf file and add the following code:

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_vary on;
gzip_types text/plain text/css text/javascript image/svg+xml image/x-icon application/javascript application/x-javascript;

Final Thoughts: Everything You Need to Know About WordPress GZIP Compression

While there are plenty of ways to improve your WordPress site’s speed and page load time, GZIP compression is one of the easiest ways to do it.

Don’t wait for slow page load times to affect your businesses bottom line. Check your website to determine if WordPress GZIP compression is enabled. If it isn’t, you have plenty of tools at your disposal to turn the tides in your favor.

Once you’re done with WordPress GZIP compression, there are still several additional tactics you can employ for improving page speed. Educate yourself and take advantage of the available options—like image optimization plugins or using a CDN.

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
Rate this post
error: Content is protected !!