How To Fix Leverage Browser Caching In WordPress Website

A cache is mechanism that particularly operates between the web server and the browser. Normally, cache stores copies of multiple files(e.g.html/php/css/js files) for faster access, instead of constantly requesting those files from server. Leverage browser caching is one of the effective ways to cache files.

How does it work?

If you are continuously fetching resources over the network, you may face site load time with web server. In that case, leverage browser caching helps you. It means webmaster has instructed browser to store some of your webpage resource files. When a web browser displays your requested webpage, it automatically loads several things like your logo, CSS files, HTML files, PHP files, and other resources.

Code to be added to your .htaccess file

Find your .htaccess file in the root of your domain. Below is the code you should add to .htaccess file, and you can set time period how long to “remember it”.

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"


  • wordpress, browser caching
  • 0 Users Found This Useful
Was this answer helpful?

Powered by WHMCompleteSolution