How to Set Leverage Browser Caching in WordPress

If you are looking to improve your website loading time drastically, you must set leverage browser caching in your website. In order to display a website correctly, internet browsers download all the web files including CSS, HTML, Javascripts, and Images. So it is obvious that bigger the site is longer it takes to load the site. It is important to have a website that load faster in order to improve user experience and eliminate Google Search Ranking penalties.

Fortunately, there is a simple solution to this problem: Enable Leverage Browser Caching. Leverage browser caching can help you store some of the website data in users internet browser. This will load the website much faster on repeated visits.

Now let’s discuss how to set leverage browser caching on your website. There are two simple methods to do this: Through W3 Total Cache plugin and Editing .htaccess file. Here is a screenshot of loading time prior to enabling leverage browser caching. Check the end of this article for a screenshot after enabling leverage browser cashing.

Leverage Browser Caching


Method 1 – How to set leverage browser caching through W3 Total Cache Plugin

W3 Total Cache Plugin offers a simple method to enable leverage browser caching. Many WordPress websites, including uses W3 Total Cache plugin. Follow the steps below.

Step 1 – Download and Install W3 Total Cache Plugin.

Step 2 – In WordPress Dashboard, navigate to Performance -> Browser Cache.

Step 3 – Set the parameters according to screenshot shown below. You can set these to your liking.

Leverage Browser Caching

Step 4 – Hit Save All Settings. That’s it!


Method 2 – How to set leverage browser caching through .htaccess file

Step 1 – Access cPanel and go to Files.

Step 2 – Open .htaccess file in Editor.

Step 3 – Add the following code to .htaccess file and Save.

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"

You can change the parameters to your liking in the code above.Depending on the nature of your website, you might need to increase the cache timing on certain fields.


Now let’s check our website ( loading time after setting up leverage browser caching. In the screenshot below, you can see our website overall score increased to almost perfect! And website loading time increased about 10%. Although our website is a small blog with posts, this change could be massive for bigger websites. Let us know how much your website improved after enabling leverage browser caching in the comments section below.

Leverage Browser Caching


Also read: How to Check Website Loading Time & Performance


Related Articles

Leave a Reply

Your email address will not be published.