Every time when we check our website page speed we are very often see an issue leverage browser cache. Today I’m going to show how to fix leverage browser cache issue.
what is browser cache ?
Every time when any browser loads a webpage, it will downloads website each and every (image, HTML, CSS, JS) static file from website hosting server for load properly. This process repeat every time when visitor revisits the same website. Using browser cache you can reduce your blog load time. enabling browser cache means browser will cache your website static files for certain days or months or years. So if any visitor revisits that page or move from one to another page on same website; browser will not re-download again website static files they served that static files from browser cache.
Why need to fix leverage browser cache ?
It will improve your blog load time and improve your blog SEO. it also reduce number of HTTP requests for regular visitors.
How to fix leverage browser cache –
To fix leverage browser cache, you need to add expires header in your website .htaccess file. Expires header define how much time visitor browser will cache your static files.
First check your website page speed on Gtmetrix.
Use word press plug-in to directly edit your website .htaccess file from word press dashboard.
Open your website Cpanel >> file manager >> web root (public_html) [tick on show hidden dot files] >> .htaccess
Note – before edit your .htaccess file must backup your original .htaccess file.
Now copy below code and paste it at the top of your .htaccess file.
## EXPIRES CACHING ##
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 application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 1 month”
## EXPIRES CACHING ##
Wait 2-3 minutes then check your website page speed. It will surely increase your website page speed 5-10%. If you face any issue on add this code into your .htaccess file leave a comment below.