How to do Leverage Browser Caching

Before we stat with How to do Leverage Browser Caching, we should look what is a browser caching and where it is used.

Browser Caching

Caching/storing contents/resource files of a website on the local computer is known as Browser Caching.In “Leverage browser caching”, the webmaster will be deal with the resources that should be stored on your local computer. This.This resources can be anything, like CSS, HTML, etc.So, when a browser local a webpage next time, it will fetch the previously cached files from your computer.This technically increase the webpage speed, by reducing the loading speed.

How to enable Leverage Browser Caching ?

TO enalbe Leverage Browser Caching, Change the request headers of your resources.
Optimize caching methods/strategy that you have applied.

How to enable Leverage Browser Caching on websites ?

The .htaccess file in the root directory of your website controls many things. You can enable Leverage Browser Caching on your website by editing this .htaccess file.

Just copy paste the code from below section and copy it in the .htaccess file of your websites.You can find the .htaccess files on the root directory of your website.


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


Also, you can change the caching time of resources in the above code.
To download the above code a file click here : Download

[wpdm_package id=’82’]