How to fix leverage browser cache via .htaccess

How to fix leverage Browser cache

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.

How to add expires header –

First check your website page speed on Gtmetrix.

Use word press plug-in to directly edit your website .htaccess file from word press dashboard.

OR

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 ##
<IfModule mod_expires.c>
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
</IfModule>
## 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.

How to fix leverage browser cache via .htaccess
Rate this post
Md. Hamim Mondal
 

Hello Readers, welcome to my Blog MyTrickSchool.com. I'm Md. Hamim Mondal, an entrepreneur Blogger from India. Here I write Blogging, SEO, WordPress and Make Money Online related Posts.

Click Here to Leave a Comment Below 0 comments