Knowledge Base
MilesWeb / WordPress FAQ

How To Fix Leverage Browser Caching In WordPress Website

Approx. read time : 3 min

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”.


How Would You Verify?

Checkout the below screenshot. You can see that Expiry header set in response header of your file.



  1. Leveraging Browser caching will improve your website speed, by which you can give your users a better experience.
  2. ExpiryType should be at a minimum of a week or one month (normally recommended for 1 year).
  3. Do not set your browser caching more than a year in advance.
  4. In case you need precise control over when resources are invalidated, you are recommend to use a URL fingerprinting or versioning technique. (Fingerprinting is the technique use to give each asset (CSS and JavaScript files) a unique name. So, whenever one bit in an asset (such as a CSS files) changes, its name automatically changes, and browser gets updated asset. Fingerprinting uses the unique name which is calculated the same across multiple servers, which stays identical, as long as the asset is identical.)

Looking for best WordPress hosting solution, look no further than MilesWeb!!



Need help? We’re always here for you.