Leverage Browser Caching In WordPress- Best In 2023

Overcome Leverage Browser Caching In WordPress

Is your site currently running slow, and you don’t know why it could be. There are many reasons for your site to be slow. The first thing you have to do is check the status of your website and get a full report from GTMetrix.

Below is an example of a website report. As you can see the Leverage browser cache is red. And that’s not ideal at all.

website report for Leverage Browser Caching

To overcome leverage browser caching in WordPress is quite easy, but before solving this problem, it’s good to know how Leverage Browser Caching actually processes with your web browser.

Read More: How To Backup WordPress Website Via cPanel

What is Leverage Browser Caching?

When a webmaster determines for himself how their website resources should appear in the reader’s browser. Whether it’s text data, images, scripts, CSS, or whatever the web page is serving. All processes performed by this webmaster take advantage of browser caching.

That means when a user visits a web page for the first time. All unchanged text data, images are cached or stored in their web browser.

By doing this, visitors will have a better user experience with your website because the website will load faster. Because browsers don’t have to load entire websites all the time.

How to Overcome Leverage Browser Caching

There are several ways to overcome the leverage of browser caching in WordPress, namely with caching plugins and also via .htaccess. We’ll look at both of them here, and you can choose either one to increase your blog speed.

So, in this article, we are going to look at how to get rid of it and increase the page speed of your website.

How to Overcome Leverage Browser Caching Using .htaccess

This is one way of dealing with Leverage Browser Caching in WordPress without plugins. All we need to do is put a small part of the code in the root file in WordPress, namely access .htaccess. Leverage Browser Caching with Htaccess files is the easiest and most effective method you should learn.

Step 1.  Login to your  Cpanel  Hosting.

Step 2.  Locate File Manager and Click on it. This will open all the files of your WordPress site.

Step 3.   Navigate to the public_html folder, and find the file called .htaccess  from the right pane.

public_html folder

Step 4.  Select  .htaccess  and right-click on it then select Edit. This will open a window, where you can add code for caching.

Note:  We recommend backing up your .htaccess file before making any changes to make it safer.

Step 5.  Scroll the file containing the code to the bottom and paste the code below at the end.

#Customize expires cache start - adjust the period according to your needs
<IfModule mod_expires.c>
FileETag MTime Size
AddOutputFilterByType DEFLATE text / plain text / html text / xml text / css application / xml application / xhtml + xml application / rss + xml application / javascript application / x-javascript
ExpiresActive On
ExpiresByType text / html "access 600 seconds"
ExpiresByType application / xhtml + xml "access 600 seconds"
ExpiresByType text / css "access 1 month"
ExpiresByType text / javascript "access 1 month"
ExpiresByType text / x-javascript "access 1 month"
ExpiresByType application / javascript "access 1 month"
ExpiresByType application / x-javascript "access 1 month"
ExpiresByType application / x-shockwave-flash "access 1 month"
ExpiresByType application / pdf "access 1 month"
ExpiresByType image / x-icon "access 1 year"
ExpiresByType image / jpg "access 1 year"
ExpiresByType image / jpeg "access 1 year"
ExpiresByType image / png "access 1 year"
ExpiresByType image / gif "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
#Expires cache end

Do as shown below. How it should look in your .htaccess file.

htaccess

Step 6. Press the Save Changes button, to save changes.

How to Overcome Leverage Browser Caching Using Plugins

To solve the browser caching leverage report in WordPress, we can take advantage of a caching plugin such as W3Total Cache. W3TC is one of the popular plugins and has great potential to increase page speed. So let’s get started.

Step 1. Activate and install the W3Total Cache plugin from your WordPress dashboard. Once done, you will be able to see a new option on the right side of the wp dashboard “W3 total cache.”

Step 2. Navigate to the  General settings, now switch it to preview mode. So that the changes you make can be seen immediately before even saving the settings.

Browser Cache

Step 3. Scroll down a little bit until you see  Browser Cache and  Enable it by checking the box.

Step 4. Click  Save.

By enabling this option, you have enabled all browser cache options. And admin will configure it in the section below.

Browser Cache

Now, we will add header caching. From the left pane in  W3 Total Cache, select browser cache to enable some more cache options.

Check all options below in the General settings browser cache.

General settings in browser cache

Set Last-Modified header

It contains the last modified date and time of the resource which is logged by the origin server. So enable it to make web pages load faster.

Set Expires header

Make sure this is checked, this is used to end most of the important header files. This will increase the browser cache files.

Set Cache-Control Header

It is basically an HTTP header that really takes into account the time and the specific file type to the cache.

Set Entity Tag (E Tag)

This can allow the cache to work more efficiently, as it identifies a specific version of any resource. And Enabling it can save bandwidth because the server doesn’t have to send a full response if the content isn’t changed at all. E Tag is much more effective.

Set W3 Total Cache Header

Setting up the W3 Total Cache header helps identify optimized files and performs faster loading.

Enable HTTP (gzip) compression

This is one important and often overlooked factor, enabling it will reduce the download time of the entire web page all text files.

Now, even though browser cache is enabled and all headers have been tuned. It’s time to set Expires header lifetime: (in seconds), so you want the browser cache to function.

To do that, scroll down a bit and make changes to all.

Set CSS and JS Expires Header Lifetime

Set CSS and JS Expires Header Lifetime

Set HTML and XML Expires Header Lifetime

Set HTML and XML Expires Header Lifetime

Set Media & other Files Expires Header Lifetime

Set Media & other Files Expires Header Lifetime

Step 5: Click the Save button to make all changes take effect.

Now you have successfully configured W3Total Cache settings for Leverage browser caching in WordPress.

Now, you may want to check your website again for the difference in numbers. Most importantly, your readers will have a better browsing experience.

Conclusion

So that’s how to get around browser caching leverage in WordPress. If you don’t want to edit the .htaccess file for the same and look for an alternative method. You can do this by using plugins.

With this, your page speed will increase. And this is an important part of SEO. One important ranking factor. Both the process through plugins and also from .htaccess work fine.

So many articles on  Best Ways to Overcome Leverage Browser Caching in WordPress. Look forward to other interesting articles and don’t forget to share this article with your friends. Thank you…

Leave a Comment