How to Leverage Browser Caching in WordPress {with/without} Plugin

Updated on

Are you looking for an effective solution to Leverage Browser Caching in WordPress? If I am reading you right, you must be exploring the ways to increase your website loading speed. And tools like Google PageSpeed Insights or GTmatrix or Pingdom probably suggested you to Leverage Browser Caching via htaccess as a result. Or you might be looking for a Leverage Browser Caching WordPress Plugin?

Well, in this article, I am going to cover all the queries to Fix Leverage Browser Caching Warning. Further, I will also share some simple but very effective techniques to implement browser caching on your WordPress site.

Fastest WordPress Hosting Anywhere!
How to Leverage Browser Caching in WordPress
How to Leverage Browser Caching in WordPress

And by any chance, if you have hosted your website on a shared hosting plan offered by Bluehost or SiteGround or any other similar hosting provider, you must apply the following methods to improve your site performance.

Did you read somewhere that Leverage Browser Caching via Htaccess can help you to increase your site speed?

Yes/No? Not Sure?

It’s all right, let me tell you one secret.

As per my experience,

Leveraging Browser Cache can help you to Increase your Website Loading Speed by up to 50%.

Click to Tweet

Now, you must be thinking about how it could be possible?

Stay with me, and I will explain it all in the following sections. But before we learn how to leverage browser caching, first we must understand what is the Browser Caching?

What is Leverage Browser Caching?

Browser caching is a technique, which allows a browser to locally store the cacheable resources (i.e. Images, JavaScript and CSS) of a website for a certain period of time. So, the browser only needs to download the updated resources while navigating the same website again. Thus, it improves site loading speed.

The method to take advantage of Browser Caching technique to improve your site loading speed called Leverage Browser Caching. 

Leverage Browser Caching for the Following Cacheable Resources

Leverage Browser Caching Warning - Think With Google
Leverage Browser Caching Warning – Think With Google

While performing a test on think with Google, you can often notice a recommendation to leverage cache in the browser for the following cacheable resources in WordPress.

In most of the cases, the cacheable resources are the website files (such as images, JavaScripts, and CSS) which can be stored by the browser temporarily.

Google PageSpeed insights (API version 5) also recommends to Serve static assets with an efficient cache policy.

Learn, How to Speed up any website by 50% by only optimizing the htaccess file. Increase Site Loading Speed using htaccess.

How to Leverage Browser Caching in WordPress

3 Simple Steps Leverage Browser Caching in WordPress 

  1. Install and Activate the Leverage Browser Caching – WordPress plugin
  2. Plugin will Specify the Expire Headers, Cache-Control Headers and Turn Off the ETags using your htaccess file.
  3. Test your site with PageSpeed tools again to see the changes.

Head over to the following section to for more details to Leverage Browser Caching via htaccess in WordPress with or without using a plugin.

How Leveraging Browser Cache can Speed-up Your Site

Before I go into the details, let’s first understand how Browser Caching Works? And how it helps to load your web pages faster.

A web browser needs to retrieve many resources from the server (i.e. HTML files, CSS file, JS files, text, images, etc.) in order to load a website.

Web Cache is the technology used in web browsers and software applications to ‘temporarily store’ or ‘remember’ visited web page resources on local disc. This temporarily stored data is called ‘ Web Cache’ or ‘HTTP Cache‘.

And when you visit the same website again. This time the browser downloads only updated content from the website and combine it with ‘temporarily stored’ data of that same website.

Due to this, web cache help to reduce bandwidth usages, server loads, etc. Therefore, Leverage Browser Caching became important to load your web pages faster.

In other words, it commands your web browser to

  • Cache the website files locally for a set time period and,
  • Loads the file from the local storage for next visits till the said period.
  • As a result, loading website files from local storage help web browser to render and display website quicker.

Did you know that the Leverage Browser Caching is the most recommended action by PageSpeed Insights from the last five years?

Click to Tweet

Did I Leverage Browser Caching on my Website?

Absolutely Yes!

Okay, first of all, let me share my experience with you and then you can decide.

I have implemented Browser Caching on my website in 2014 and getting amazing results in terms of loading speed since then. And as a result, PageSpeed score of my website is nearly 100.

GTmetrix - PageSpeed Test Result
GTmetrix – PageSpeed Test Result

(Disclaimer – I got this PageSpeed score not only because of the implementation of Leverage Browser Caching on my website, but I have applied some other optimization techniques as well to achieve this score.)

You can also implement browser caching on your website easily by adding a simple piece of code in the htaccess file. Due to which, Leverage Browser Caching via Htaccess in WordPress is one of the best and easiest way I could recommend.

However, if you do not want to play with htaccess file of your website, It’s okay. There are several free WordPress Plugins to Fix Leverage Browser Caching Warning you can find in the WP repository.

But which plugin you should use? Jump on the plugin section to know more about my recommended Leverage Browser Caching WordPress plugins.

Furthermore, in the following sections of this article, I’ll discuss how you can Enable Leverage Browser Caching in WordPress with or without plugins? And why you should not avoid this?

Do you know that you can Increase Page Loading Speed by Minifying and Combining the Static Resources of your website? Here is a tutorial you must read to Minify JavaScript and CSS in WordPress.

How to Fix Leverage Browser Caching Warning

In order to Fix the Leverage Browser Caching Warning, your web server should allow web browsers to store visited webpage resources temporarily on the local disk.

Further, when the user will visit your site again, consequently, it will load faster because of the locally available resources.

As a result, you will notice a significant improvement in your website loading speed. We all learn this earlier, Right?

Your next question must be how to enable this? How your webserver will allow a browser to leverage web cache.

Serve Static Assets with an Efficient Cache Policy

The static assets like CSS, JavaScript files and images should be delivered with an adequate cache policy [1]. As HTTP caching can help you to speed up your page load time for returning users. You should increase your cache lifetime to speed up repeat visits to your page.

To Serve Static Assets with an Efficient Cache Policy, you need to Set Content Expiry Dates by adding Cache-Control Headers and ETag Headers in HTTP headers.

  • Cache-Control states about the caching period of a particular file by the web browser.
  • While ETag is used to verify changes between the cached resources and requested resources.

We can set a specific period in months or years to keep cache resources (i.e. HTML, CSS or JS files, images, etc.) locally.

Moreover, it is advisable to Set Expiry Dates as per the frequency of changes in resources, or in other words, how often you update static resources of your website.

Enable Leverage Browser Caching in WordPress

You can Enable Leverage Browser Caching in WordPress [2] by

  1. Adding Expire Headers
  2. Adding Cache-Control Headers and
  3. Turning ETags Off.

Let’s discuss in detail how to add Expire headers & Cache-Control headers, and how to Turn ETags Off in HTTP headers.

Leverage Browser Caching via htaccess (without plugin)

Let’s learn how to Leverage Browser Caching via htaccess on Apache Server without WordPress plugin. If your website is hosted on Apache Server, you can edit your htaccess file, read more here about How to Edit htaccess file in WordPress.

Step by step instructions to Leverage Browser Caching in WordPress via .htaccess:

  1. Go to WordPress Dashboard/cPanel of your website.
  2. Open .htaccess file (or config file).
  3. Paste the code given below in .htaccess file of the WordPress site.
  4. Save changes and you’re done.
  5. Test your site with PageSpeed tools again to see the changes.

1. Add Expire Headers (Apache)

# TN - START EXPIRES CACHE 
ExpiresActive On
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/svg "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/xhtml-xml "access 1 month"
ExpiresByType application/javascript "access 1 month" 
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresDefault "access 1 month"
# TN - END EXPIRES CACHE

You can Add Expire Headers in the WordPress htaccess file easily. However, It would be good if you set expiry dates for a year. Less than a month or beyond one year is not recommended.

Furthermore, you should add the Cache-Control Headers below the Expire Headers code in htaccess file.

2. Add Cache-Control Headers (Apache)

# TN - BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpeg|jpg|png|gif|swf|pdf|svg)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</filesMatch>
</ifModule>
# TN - END Cache-Control Headers

You can specify timeline in Cache-Control Headers, but it won’t be necessary as you have already set expiry dates for the cached resources.

Finally, you need to Turn ETags Off. You can read more about ETags here.

3. Turn ETags headers Off (Apache) for Multi-server sites or CDNs

# TN - BEGIN Turn ETags Off
FileETag None
# TN - END Turn ETags Off

After that, save your WordPress htaccess file and clear all the cache if you are using a cache plugin.

That’s it, you have successfully enabled Leverage Browser Caching via htaccess.

Do you know that Gzip compression can also increase your website loading speed? Have you enabled it yet? If not, read this effective guide to Enable Gzip Compression in WordPress.

Leverage Browser Caching in NGINX

Now, If you are on Nginx server you can Leverage Browser Caching without using a WordPress plugin by adding following code in the .conf file.

You can find the configuration file at this location… /etc/nginx/sites-enabled/default

1. Add Expires Headers (NGINX)

location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf|svg)$ {
expires 365d;
}
location ~* \.(pdf|html|swf)$ {
expires 90d;
}

2. Add Cache-Control Headers (NGINX)

location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf|svg)$ {
expires 90d;
add_header Cache-Control "public, no-transform";
}

If you have multiple websites on NGINX Server. I recommend you to create a xyz.conf file and add the above-mentioned code. Save this file in this folder /etc/nginx/sites-available/xyz.conf

Reload Nginx server after editing, that is it. Congratulations you have successfully activated Leverage Browser Caching on NGINX Server.

To fully optimize your WordPress site speed you should Remove Render Blocking JavaScript and Defer the loading of JavaScript files. Explore here now!

Leverage Browser Caching WordPress Plugin

Now, let’s have look on the popular Leverage Browser Caching WordPress Plugin. I usually recommend to use the code in the htaccess file rather than using a WP Plugin.

However, here are the three most reliable and popular WordPress plugin to fix Leverage Browser Caching warning.

#1. WP Fastest Cache

WP Fastest Cache is one of the most popular and recommended Leverage Browser Caching WordPress Plugin. This Five Star Rating WP Plugin is available on the WordPress repository for free. As of now, the WP Fastest Cache plugin has more than a million active installations.

WP Fastest Cache | WordPress Plugin to Fix Leverage Browser Caching Warning
WP Fastest Cache | WordPress Plugin to Fix Leverage Browser Caching Warning
  1. Download and activate the plugin – WP Fastest Cache.
  2. Go to Settings → WP Fastest Cache
  3. Select the Browser Caching checkbox and
  4. Click on the Submit button and you are done.

After that, a message will be displayed “Options have been saved”. Check out the following image for reference.

Congratulations! you have successfully fixed Leverage Browser Caching warning on your website.

WP Fastest Cache WordPress Plugin Setting
WP Fastest Cache WordPress Plugin Setting

In addition to fixing Leverage browser caching warning, this plugin comes with some great features to improve page speed like,

  • Enabling Gzip Compression
  • Minify HTML and CSS
  • Combine CSS files and JS files to reduce HTTP requests
  • Furthermore, it can also generate static HTML files of a dynamic WordPress site, etc.

Install the plugin to explore all the available features now.

#2. Cache Enabler – WordPress Cache

Another plugin on the list is  Cache Enabler – WordPress Cache. This is a 4.5+ Star Rating plugin. Apart from, browser caching, this plugin has some unique features to speed up your site.

Above all, it is developed by KeyCDN, so you can certainly trust this WordPress Plugin for Leverage Browser Caching. Besides, it does what it says and also compatible with other WordPress performance plugins.

Cache Enabler – WordPress Cache
Cache Enabler – WordPress Cache
  1. First of all, Install and Activate the Cache Enabler plugin.
  2. Go to the plugin setting page.
  3. Click to Enable Leverage Browser Caching.
  4. And, that’s it.

This plugin also has many other features, which one should explore, such as…

  • Allows you to Automated and/or manual clearing of the cache
  • Purge Page-specific cache manually
  • It will display the total cache size directly on your dashboard
  • Allows you to minify HTML and inline JavaScript
  • Also, work with Custom Post Types and many more

#3. W3 Total Cache – WordPress plugin

I am sure that you probably have heard about W3 Total Cache – WordPress plugin. You can also use the W3 Total Cache Plugin to fix Leverage Browser Caching Warning in WordPress.

Follow the steps to fix Leverage Browser Caching warning with W3 Total Cache …

  1. First of all, download, install and Go to General Settings of W3TC
  2. Scroll down and Enable the Browser Cache and Save all settings
  3. Further, navigate for the Browser Cache Settings Tab available on top of the page.
  4. Specify Cache Headers available in General Settings on this page.
  5. Set Expires Headers, Set Cache-Control Headers and Set entity tag (eTag) – Check all boxes.
  6. Save all the settings after that and you are good to go.
W3 Total Cache Browser Cache Settings
W3 Total Cache Browser Cache Settings

#4. WP Rocket

WP Rocket is a premium WordPress plugin, mostly recommended to increase your site speed by bloggers. The WP Rocket not only let you leverage the browser caching but also offers you to optimize your site using various techniques. WP Rocket let you…

  • Serve the Lazy Load Images
  • Minify and combine static resources like JS, CSS, and HTML
  • Serve the static files with Gzip compression
  • Allows you to defer JavaScript loading
  • Optimize the delivery of Google Fonts
  • Add the DNS prefetching meta tags in wp-header to load third party resources faster and
  • Let you integrate your CDN platform to speed-up your site.

After installing the plugin, you must remember, that if you do any changes in your theme, especially in the CSS/Stylesheet file. You might not be able to see the changes immediately due to browser cache. So, I would recommend you to open your site in an incognito window each time to see the changes. Here is a complete guide you can follow if CSS Changes not Showing Up in WordPress.

Leverage Browser Caching for Google Analytics

Google Analytics JavaScript file (i.e. analytics.js) is a static resource and it could be cached for any specified time. But Google did not allow to do that because they change the code every now and then to ensure proper tracking.

On the other hand, analytics.js file loads from Google Analytics servers with the Expiring Headers of 2 hours. That is why most of the page speed tools give the warning to cache the analytics.js file.

Complete Analytics Optimization Suite (CAOS) - WordPress Plugin
Complete Analytics Optimization Suite (CAOS) – WordPress Plugin

To leverage browser caching for Google Analytics, you can use the Complete Analytics Optimization Suite (CAOS) WordPress plugin.

The plugin creates a duplicate copy of the analytics.js file, and host it locally on your server. That allows you to serve the analytics.js as a static file. Resulting the fix for Leverage Browser Caching for Google Analytics. Further, the plugin automatically updates the locally hosted analytics.js file after a certain interval via Google servers.

Read our detail guide for the same below.

How to Cache Third-Party Resources

Similar to the use of Google Analytics, we also use many other external services on our website, like facebook widget, google font, any other analytics tool, etc.

These external services load third-party resources with very less expiring time due to various reasons. And you will often notice a recommendation to cache third-party resources.

Well, because we don’t have any control to Cache Third-Party Resources, I would recommend you to use limited or optimized services only. However, you can use the Preconnect link tags in your wp-header to speed-up the loading time of these third-party resources.

To add the Preconnect Link Tag, use the following code in the head of your WordPress site.

<link rel=”preconnect” href=”//fonts.googleapis.com”>

How to Specify a Cache Validator

Specify a Cache Validator, another warning you might have encountered with while testing your site on GTMetrix. The warning is particularly shown for the third-party scripts without specifying the ETag header or a Last-Modified header.

This is quite a similar situation of what we have discussed under the How to Cache Third-Party Resources section. Unluckily, because of the external nature of these scripts, there is nothing we can do to specify a cache validity header.

However, you can always use the Preconnect and DNS Prefetch tags to optimize the loading of third-party resources.

Wrapping It Up

Finally, at the end of the day, it really does not matter how you are going to Leverage Browser Caching in WordPress.

What matters is, did you enabled it or not? If Yes, then open your website in an incognito window and refresh the same page again, you will definitely notice a significant improvement in website loading speed.

Hope you find the list of Leverage Browser Caching WordPress Plugin useful. And manual methods to implement caching must have helped you to improve site speed.

Which method do you use? Do let us know in the comment section below. Or you are using another plugin to Leverage Browser Caching in WordPress.

Feel free to fire your queries or your feedback via the comment section below, I would be happy to answer.

Cheers!

General FAQ

What is Leverage Browser Caching?

Browser caching is a technique to command the browser to locally store the web pages and data for a definite time. The browser will use the locally stored data to render the same website again, which will improve the site loading speed. The method to take advantage of Browser Caching technique to improve your site loading speed called Leverage Browser Caching.

How do I Fix Leverage Browser Caching Warning in WordPress?

You need to install and activate the Leverage Browser Caching – WordPress plugin to Fix the Leverage Browser Caching Warning. The plugin will add code to Specify the Expire Headers, Cache-Control Headers and Turn Off the ETags in your htaccess file.

How do you Leverage Browser Caching for Google Analytics?

First of all, Install the Complete Analytics Optimization Suite (CAOS) plugin. Enter your Google Analytics Tracking ID in the plugin settings page. You Are Done!

In addition to that, you may be interested to read the following tutorials –

Photo of author
Saurabh K
Saurabh K is a technology enthusiast and part-time blogger. He loves to explore the efficient use of technology and gadgets. He is an outlier and lensman. Add him in your social circle to know more.
Disclaimer: Affiliate links of some product(s) are being used on this page, if you follow the link and make a purchase, we may receive compensation from respective companies. This compensation comes at no additional cost to you.

122 thoughts on “How to Leverage Browser Caching in WordPress {with/without} Plugin”

  1. Avatar of Gaurav Zawar

    Thanks Saurabh..
    I used plugin as it was easy to install and it increased score from 84 to 89 on Google Page Speed .
    I just want to know if using another plugin will increase load time than editing .htacess?
    Thank You.

    Reply
    • Avatar of Saurabh K

      Hey Gaurav,
      Glad that you find this post useful. Looking forward listen more from you.
      You can try that yourself too. Thanks for your response.

      Reply
  2. Avatar of Starmoon

    Hello..
    i wanna ask..
    yesterday i inserted some code in my .htaccess file.
    can i insert/add code Leverage Browser Caching in bottom file .htaccess again ?
    btw, sory if my english so bad.

    Reply
    • Avatar of Saurabh K

      Hi,
      Glad that you landed at this article.
      Surely you can add code at bottom your .htaccess file.

      Reply
  3. Avatar of pramod

    nice tip i used it on my blog and it working

    Reply
    • Avatar of Saurabh K

      Hello Pramod,
      Glad that I could help.
      Thanks for your feedback.

      Reply
  4. Avatar of wordpress eticaret

    thank you for sharing but dosen’t work for me. gtmetrix results still same

    Reply
    • Avatar of Saurabh K

      Thanks for you feedback.
      Your score might already be good.
      Looking forward to listen more from you.

      Reply
  5. Avatar of James George

    Thank you for the information, it definitely works !

    Reply
    • Avatar of Saurabh K

      Hey James,
      Glad that I could help.
      Thanks for your response.

      Reply
  6. Avatar of arun

    My blog speed score jumped from 64 to 75, Thanks for the lovely information 🙂

    Reply
    • Hey Arun,
      Glad that I could help. That’s a good improvement. Looking forward to listen more from you.
      Thanks for awesome feedback.

      Reply
  7. Avatar of cool games

    Nice information for sharing ….

    Reply
    • Hey,
      Glad that you find it useful.
      Thanks for feedback.

      Reply
  8. Avatar of mathu

    thanks a lot. used the .htaccess and my website increase mobile speed from 60% to 77%

    Reply
    • Avatar of Saurabh K

      Hey Mathu,
      Glad that I could help.
      Thanks for your feedback.

      Reply
  9. Avatar of Ricardo

    Thank you for this tutorial. I’m trying to optimize my website’s speed as best as possible I can. This information is very useful for beginner WordPress webmasters.

    Reply
    • Hey Ricardo,
      Glad that it was useful for you.
      Thanks for dropping by.

      Reply
  10. Avatar of Deepanker Verma

    Great post. I knew about the first method but was not aware of this plugin. Plugin is easier to use for newbie. 🙂

    Reply
    • Hey Deepankar,
      Glad that you find it useful.
      Thanks for dropping by.

      Reply
  11. Avatar of rossana

    Thanks a lot, I’ve used to have 37 and with this plugin i’m in 62.

    🙂

    Reply
    • Hey Rossana,
      Glad that I could help.
      Thanks for your feedback.

      Reply
  12. Avatar of Pritam Thakur

    This is a life saver! Thanks a lot!

    Reply
  13. Avatar of kuya

    Thank’s alot sir.. i use plugin now my score 95.. wow.. another plugin that helps me to get this score is Above The Fold Optimization, but pain in configuration. but its worth anyway.

    Reply
    • 95 PageSpeed Score is a great. Keep it up.

      Reply
  14. Avatar of itangle.co

    Thanks For this Great Article it help us for our Client website

    Reply
  15. Avatar of Sumit Sarkar

    Hi, I have a WordPress blog running in shared IIS server hosting. Is there any plugin that can do the trick please?

    Reply
    • Insert the following element under in your web.config file.

      Reply
  16. Avatar of Gaurav Verma

    WP Fastest cache premium plugin is good

    Reply
  17. Avatar of Steve Parkinson

    I tried editing the .htaccess file and although I could access the home page, I could not open any of the internal pages???

    I used the WP Fastest Cache plug-in and that did help a little.

    Think I just need to study this more…

    Thanks, interesting blog

    Reply
  18. Avatar of Des Walsh

    I think I know the answer to this but I’d value your comment. I’ve installed w3 Total Cache and activated browser caching, so I see the change from that to the .htaccess file. Previously I had used the standard code you provide above for the Apache server and that code is still in the .htaccess. So I am guessing I should choose one or the other, or is it possibly helpful to have both?

    Reply
    • Hey Des,
      I would suggest you to choose one method to leverage browser caching. Howevere, keeping both the codes in htaccess dont hurt anyone either.
      Thanks for stopping by.

      Reply
  19. Avatar of Alan

    Thanks, it helped my speed score form 85 to 93.

    Reply
    • Hey Alan,
      Glad that I could help.
      Thanks for stopping by.

      Reply
  20. Avatar of John Carnival

    It would be great if you can add the w3 cache method also in the article.. looking for that update.. thanks 🙂

    Reply
    • Hey John,
      Thanks for the feedback, i will try to update the same.

      Reply
  21. Avatar of ParanormalNight

    My speed score increased from 88% to 94%! That’s huge. My page load time was 1.8s, which is great. Thanks for this post! It was way easy to install and implement.

    Reply
  22. Avatar of Aksh

    Thanks, But pls tell me one thing suppose if I am using the Leverage Browser Caching settings described above in my .htaccess file and somebody opens a page of my site, it will get stored in his browser. And after that if i update the same post or page which is opened by the man, How he will get the updated content? In other words How should I clear the cached copy of my page/post so that the updated post could be accessed by everybody?

    Reply
  23. Avatar of Dishant Shukla

    Hi Saurabh,

    Thank you for posting this solution. I want to ask one thing i have applied this script on my website. But when i check on Google developer i didn’t get any change. The files which were showing earlier have not changed. After how much time i see the effect?

    Reply
  24. Avatar of shawn

    Thanks a lot, I knew about the first method, is there some method to set expires time for other site’s js, like google analytics or some ad system js

    Reply
  25. Avatar of Adarsh Kumar Maheshwari

    hey there,
    thanks for this tip, it’s really working on my site.

    Reply
  26. Avatar of Atique rehman

    Wao great article it helps me ….. Thank you

    Reply
  27. Avatar of kumar

    superb idea sir i will definetly apply it in my blog. but i am using a home page with demobuilder like shoutmeloud or any proffesional blog. should i apply this to my blog as it can affect user experience please review my blog sachhiprerna.com

    Reply
    • It should not affect user experience, use Autoptimize plugin.

      Reply
  28. Avatar of Bhadresh Tandel

    Thanks, really helpful!

    Reply
  29. Avatar of jyoti

    Thank you for the post. This tutorial helped me to fix leverage Browser Caching warning. Besides, I improved my site performance a lot. My current speed test result is 80.
    Regards, Jyoti

    Reply
  30. Avatar of Gurjit Singh

    Thanks Very good information.

    Reply
  31. Avatar of Annapurna Agrawal

    .htaccess method doesn’t work for me. Can you please let me know why?
    Even after adding codes to .htaccess file, the same issue for leverage browser caching shows.
    Please help me out.

    Reply
    • Hi, this code should work. Could you share your website url, on which you are trying to leverage browser caching.

      Reply
  32. Avatar of Diana Lesko

    Hi! I’ve copied to the code to my htaccess. Now I have clear all the cache if you are using a cache plugin. What do I do if I dont have a cache plugin?

    Reply
    • You don’t need to do anything, server will use the new cache settings from the next time it build the cache.

      Reply
  33. Avatar of Diana Lesko

    Actually, as I’m on cloud service I have built in caching. Does it make a difference?

    Reply
    • Hi Diana,
      It won’t make much difference. However, it may take some time to delete old cache and build new as per the code use used.

      Reply
  34. Avatar of Howard

    Hi
    As a novice my pingdom score on leverage is F…
    wondering if this will help? Siteground supercache did not in that area particularly but good otherwise. Don’t know if I should try Fastest instead of siteground optimization cache super?

    Reply
    • Hey Howard,
      You can use this code in .htaccess file along with the Siteground optimisation cache super. It will work flawlessly.

      Reply
  35. Avatar of Ramana

    Hi Saurabh K,

    I did same thing for my PHP website (www.apnewscorner.com).

    I add below code in .htacess file. After adding this code new posts not loading automatically posts only load after click on Ctrl + F5.

    # TN Expires Caching Start #

    ExpiresActive On
    ExpiresByType text/css “access 1 month”
    ExpiresByType text/html “access 1 month”
    ExpiresByType image/gif “access 1 year”
    ExpiresByType image/png “access 1 year”
    ExpiresByType image/jpg “access 1 year”
    ExpiresByType image/jpeg “access 1 year”
    ExpiresByType image/x-icon “access 1 year”
    ExpiresByType application/pdf “access 1 month”
    ExpiresByType application/javascript “access 1 month”
    ExpiresByType text/x-javascript “access 1 month”
    ExpiresByType application/x-shockwave-flash “access 1 month”
    ExpiresDefault “access 1 month”

    # TN Expires Caching End #

    please let me know solution for this.

    Reply
    • Hey Ramana,
      Clear all the website cache and open your site in incognito window after that. New posts will start appearing automatically.

      Reply
  36. Avatar of Tragik Magik

    Works great

    Reply
    • Hey,
      Glad that I could help.
      Thanks for stopping by.

      Reply
  37. Avatar of Erez

    thanks for sharing. Very useful content.

    Reply
  38. Avatar of Erez

    Thanks for the information.
    I can’t seem to get rid of the render blocking message when I do a speed test.
    I’ll try some of the suggestions here.

    Reply
  39. Avatar of Fahad Rafiq

    Very good article
    I mostly use W3 Total Cache + WP Performance Score Booster.
    Editing .httaccess method is perfect.

    Reply
  40. Avatar of Imran Topu Sardar

    Hi SAURABH,
    I was unable to realize the matter as well as I was looking for a complete solution for cache guideline. Now, I have got you and it’s really the total solution for applying it on the websites.
    I have already installed WP Fastest Cache and now it is the time to see what happens.
    Thanks a lot for providing a great tutorial. Have a nice day and thanks a lot. 🙂

    Reply
  41. Avatar of Paul McGlade

    Thats for the article! I was having a problem with google speed test and Leverage browser caching so Im going to use your advice and hopefully that will help. Thanks again!

    Reply
  42. Avatar of Doni

    Grato por sua aula.

    Reply
  43. Avatar of Nirmal Kumar

    I tried using the W3 total cache plugin. But this is not working. I don’t know why this happens?

    Reply
  44. Avatar of Jitendra

    Leverage browser caching to make your webpages faster. If you can leverage browser caching, you can increase website speed considerably. Thanks for sharing this great information to all of us.

    Reply
  45. Avatar of REHMAT ULLAH

    Thanks, Man! You saved my Life <3

    Reply
  46. Avatar of ariasungroup.ir

    what is the difference between Cache-Control Headers and Expires Headers?
    is it important to put both of them in .htaccess?
    thanks for sharing this article.

    Reply
  47. Avatar of Lokender Kumar

    Hi Sourav
    Thanks for sharing the Tutorial. I have followed the htaccess method. Worked Fine. Thanks

    Reply
  48. Avatar of Ramya

    Hi,
    I need to know how to speed up my Website. At present, my website load time is 16.64 s. How can I reduce and make faster? Please help me.
    Website platform wordpress

    Reply
  49. Avatar of Jonathan Farrell

    What element?? I don’t see what you are referring to

    Reply
  50. Avatar of Freddy

    Hey Saurabh!

    Thanks for the trick, it saved me from installing a caching plugin to leverage browser caching. My Pingdom rating is now up to 87 and I reduced my page speed with a whopping 3 seconds. It is now much faster. I used the .htaccess method.

    Cheers!

    Reply
    • Glad! I could help. Thank you for stopping by.

      Reply
  51. Avatar of Alex

    Thank you sir very good article.

    Reply
  52. Avatar of Rohit Bisht

    Hello i used both the method adding codes to .htaccess file and using WP total cache but still it shows the error of leverage caching

    Reply
  53. Avatar of Indradev yadav

    Very best content, I impressed with you.

    Reply
  54. Avatar of Anx

    Hi, is it useful to adjust both – the .htacces file in cPanel and install a Plug-In?

    Reply
  55. Avatar of Umesh

    How to increase website loading speed please provided information and how to speed up newspaper theme.

    Reply
  56. Avatar of Theo Watine

    When you add the additional code in the .htaccess file, how long does it for GTmetrix to analyze the changes?

    Reply
    • It should not take any time. Just remember to clear the cache, if you are using plugin. And try to test website on GTmetrix in a incognito browser window.

      Reply
  57. Avatar of sumit kumar gupta

    Is there any plugin available for fix laverage browser caching problem in WordPress

    Reply
  58. Avatar of Rahul Chauhan

    my website speed not increased even by a single percent. Everything was applied as you said. But no effect

    Reply
    • Hi Rahul, Sorry to hear that. However, there are many other factors which affect site speed. Pl share the specific details, I would be happy to help.

      Reply
  59. Avatar of Manoj

    Great tutorial. I was facing slow speed issue on my blog and applied the suggested codes in my .htaccess file. It brought some improvements in the loading time. Thank you so much,

    Reply
  60. Avatar of Leo

    Hi,
    in Googles PageSpeed Insights my website gained 4 points for Mobile and 3 points for Desktop with your code, plus Google is suggesting to use browser caching also for the following resources:
    https://maps.googleapis.com/…........&ver=3.14 (30 minutes)
    How can I integrate this suggestion into you code?

    Reply
    • Try to defer the loading of Google Map files to improve performance. Google Maps APIs are set with 30min expire headers, we can’t change that, until we host those API files.

      Reply
  61. Avatar of Ahmed Ali

    Good Article! Levrage Browser Cashing really help to load the website faster!

    Reply
  62. Avatar of Hanifa

    Dear Saurabh K
    Where is wp super cache?

    Reply
  63. Avatar of Darshan Nagekar

    Hey Saurabh that an excellent article man
    Thanks for the amazing trick !
    You manged to reduce my site speed 🙂

    Reply
    • Glad! I could have helped. Thanks for stopping by.

      Reply
  64. Avatar of Beyan

    Hi I was used codes in .htaccess but the speed still low

    Reply
    • Hi Beyan, There could be other factors for slow site speed. Pl explain other details.

      Reply
  65. Avatar of Rishabh

    can you tell me any way to speed up my website

    Reply
  66. Avatar of Bittu

    Thank’s a lot Saurabh……good article..now my page speed score is 91

    Reply
  67. Avatar of raj

    i used wordpress plugin for browser cache after your recommendation and it works best

    Reply
    • Avatar of Saurabh K

      Thank Raj for stopping by. Glad, I could help.

      Reply
  68. Avatar of Anzik

    Website speed really matters. Thanks for your codes for leverage browser caching on wordpress it helps me to increase my wordpress website speed.

    Reply
  69. Avatar of Simon

    It would be great if WordPress.com offers free plugins the same way as WordPress.org

    At the moment, even a personal plan does not cover plugins, thus the only way to leverage brower caching is via coding.

    Thank you anyhow for creating such a comprehensive guide to leveraging browser caching, it is much appreciated.

    Reply
  70. Avatar of Martin Broder

    That was great! You really leverage browser caching those assets!

    Reply
    • Avatar of Saurabh K

      Great to see it works. Thanks for stopping by.

      Reply
  71. Avatar of Kadijah Whomanity

    I’ve been a WP user for ages, and I’ve had Cache Enabler, that works for me.
    But what you’ve shared here are all very effective too!
    Thanks again!

    Reply
  72. Avatar of Alex Costa

    Thanks for the guide, I just have one question
    will this mess with Adsense codes?
    Sorry, I am new so I don’t have much idea about this.

    Reply
    • Avatar of Saurabh K

      Browser caching is for internal resources. It does not affect the Adsense code.

      Reply
  73. Avatar of Michael

    Thanks for the tips. I implemented them and managed to improve my site speed substantially. By the way, I really like the sticky floating post share bar in this post. Which plug-in are you using?

    Reply
    • Avatar of Saurabh K

      Glad, you find it helpful. It is a custom plugin we use for the social share buttons.
      Thank you for stopping by.

      Reply
  74. Avatar of Saurav Sharma

    Thanks for providing in-depth article on Leverage Browser Caching for website. I am using WP fastest cache plugin for my website, I have noticed a bit of improvement in website speed not what I had expected. Some Plugins itself a heavy resource on web servers. So this time I am going to implement Browser caching without plugins. I hope this would work out!

    Reply
    • Avatar of Saurabh K

      Did it work for you?

      Reply
  75. Avatar of Tanmoy Biswas

    Add Expire Headers code working for me
    Thanks for your nice tutorial

    Reply
  76. Avatar of Tanmoy Bisws

    I have a problem, I am using WP rocket pro but my website still showing, The Leverage Browser Caching Warning. I do not know, what should i do now.
    Please suggest me

    Thanks

    Reply
    • Avatar of Saurabh K

      Hey Tanmoy,

      Just use the above code in your .htaccess file. It will remove the Leverage Browser Caching Warning for all the static resources of your site.

      However, there are many other things you should consider to improve your site performance. Minification, defer JS, lazy loading, etc. Feel free to read our tutorials on the same.

      Reply
  77. Avatar of giày đá bóng

    The article has extremely quality content, I appreciate it, your article will surely bring a lot of useful knowledge to everyone. respect you

    Reply

Leave a Comment

Your email address and website details will not be published. Required fields are marked with *.