How to leverage browser caching of your website or blog

If you are using any kind of website speed testing tool or website optimization tool, it suggests to leverage browser caching. Google’s PageSpeed Insights tool also delivers this kind of suggestions. See the snapshot below:

leverage browser caching

If you are not sure what is browser caching and how to leverage browser caching, you should read this guide. In this article, I am trying to explain everything in easy to understand manner.

Also read: How to Speed up WordPress Blog [Guide]

What is browser caching?

Browser caching is the feature of web browsers which stores web page resources on local computer when a user visits a web page. Next time when the user visits the web page, it will use the local cache to serve the page fast.

By web page resources, it means images, CSS and JS files. So, these things will not be loaded again and hence, it will improve the load time of the page for repeat visits.

When you leverage browser caching, it means the resources of the web pages will be saved in browser cache to make your website faster for repeat visits.

How to leverage browser caching

To leverage browser caching, you need to enable caching by adding some code in .htaccess on your web host. For this, go to file manager on your web host and edit the .htaccess file.

Note: The .htaccess file controls many important things. So, be very careful while editing it. A single error will take down your website.

Browser caching for .htaccess

Add this code in the .htaccess file.

You can see the above code and check the time period of caching for different things.  If you want to change the caching time for any specific file-type, you can change that value. It should be “1 year”, “1 month“ or “1 day“.

How Leverage Browser Caching in WordPress

The .htaccess file is for web host. So, the above method works with all kind of CMS including WordPress, Drupal, Joomla and frameworks like Codeigniter, YII and other. Just use the above code and add it to the .htaccess file.

Common issues if you use caching

If you are using caching, you will issues while changing something in your website’s design. As the browser will cache these resources for long time, it will time to reflect changes. But this is not something very serious. You can overcome this by using ‘URL fingerprinting’.

Final Words

I hope this article is useful. I tried to explain everything in simple words. If you still have anything to ask, you can comment below. I will try to reply as soon as possible.

advertisement

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest updates, web design resources and tools.

You have Successfully Subscribed!

About The Author

  • ADD YOUR COMMENT

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Receive fresh web design resources and SEO tips in your email by our weekly newsletter

You have Successfully Subscribed!