How To Solve Leverage Browser Caching Issue In WordPress

Have you ever tested your website speed? Either using Google Page Speed Insight or Pingdom, then you might have seen few issue which should be fixed for making your website faster. Then you might have seen the Big Yellow Leverage Browsing Caching warning.

In case you are not aware of it. Check out the screenshot below.

1. Check the Speed of your website

Slow website page error solved
Google Page insight Speed test

2. Leverage Browser Caching Warning

How to solve Leverage Browser Caching error
Leverage Browser Caching Warning

You can use Gzip Compression for Solving this issue.

What is Gzip Compression?

Gzip is a method of compressing files (it makes file size smaller) for faster network transfer. It is also a file format.

Compression of files allows your web server to provide smaller file sizing which load faster for your website users.

How to use gzip compression
Image Compression

How To Enable Gzip Compression?

Compression can be enable by adding codes to a file .htaccess on their web server. It mean you have to access this file using your cpanel.

The .htaccess controls many important things of your website . Below are the codes which should be added to .htaccess file..

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

After adding this code to your .htaccess file save it and refresh your webpage.

If you want to check whether Gzip is working or not. You can check using Gzip Compression Tool

Read Also :How To Start A Blog: Easiest Way to Start Your Blog under $3 per month

Enable Gzip Compression for NGINX webservers

If you are using NGINX server then you need to add below code to your cong file.

gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";

# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;

Enable Compression On Apache Server

The very first code will work for Apache web server But in case it wont work then replace this code to the existing code..

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/x-javascript

Hope above method had solved your issue. If you have any query related to this article kindly share your comments.


Leave a Reply

Back to top button