Fix Google PageSpeed leverage browser caching in htaccess
To optimize browser caching in htaccess, simply add the following code inspired by a Stack Overflow thread [1] in your htaccess file :
It will allow you not only to pass the Google PageSpeed leverage browser caching test, but most importantly to speed up your website access time.
For example, this allowed me to pass the Google PageSpeed [2] test leverage browser caching [3] (along with Eliminate render-blocking JavaScript and CSS in above-the-fold content [4]) on a website, going up from a score of 51 on mobile (Fig 1) to 72 (Fig 2), and up from 59 (Fig 3) to 79 on desktop (Fig 4).

About the author - YB Digital
Yoann is an International Business Consultant, facilitator and coordinator. He worked more than 10 years in global business, supply chain, financial, SAP ERP projects, Web and SEO optimization for various industries, such as logistics, cosmetics, consumer goods, beauty care, or fashion, in more than 30 countries around the globe.
Yoann is an International Business Consultant, facilitator and coordinator. He worked more than 10 years in global business, supply chain, financial, SAP ERP projects, Web and SEO optimization for various industries, such as logistics, cosmetics, consumer goods, beauty care, or fashion, in more than 30 countries around the globe.