How to Leverage Browser Caching manually with WordPress via .htaccess

Must Read : How to Leverage Browser Caching manually with WordPress via .htaccess

Leverage Browser Caching refers to caching the static files of your WordPress blog in the Visitors browsers for a time period by adding expiry headers, so that if the visitors visits your website again ,there will be no need of downloading the same static files once again, as in about 99.9% cases the static file remains same.
Static files includes Logo of Your WordPress blog,Stylesheet(CSS File),Javascript Files and lots of other Images.

To Leverage Browser caching, you will add expiry headers to the static files. By adding expiry headers you will be able define that when the static files should be downloaded again in the visitors browsers, if they visit your blog regularly.

For Example: If you have stated the expiry header for CSS file 30 days, when a visitors loads your website in the browser, it will download all the static files including the CSS file,now once again he visits your website after 10 days and now once again he will download all the files except the CSS file as you have stated that the expiry header for CSS file as 30 days,that means now it will not download the CSS file for next 30 days once it is downloaded in the visitors browser.

Benefits of Leverage Browser Caching

1.Improves Load time of your WordPress blog for the regular visitors.
2.By caching static files,you reduce the number of HTTP requests for the regular visitors.
3.Lots of search Engine like Google consider this while grading the overall experience of your website.

 


As you can see we have declared 1 year for different types of Images and 1 month for other files,you can change them as per your needs to anything.

How to Find .htaccess Files to Enable Leverage Browser Caching in WordPress Blog:

 1.Default-If you are using cPanel,open the cPanel and then Navigate to “File Manager” > Tick on “Show Hidden files (dotfiles)” and select “Web Root(public_html)” >> Click on “OK” >> You will see .htaccess there add the above code in it, better add it in the end.

2.Yoast SEO Plugin-If you are using Yoast SEO Plugin you can easily Edit your .htaccess files,Just Navigate to Plugin Settings Tab i.e, SEO tab>Edit Files here you can edit .htaccess files.

3.If you are using Security plugins-Lots of Security Plugins edit the .htaccess files and take over the control to it,In that case you will have to find the settings by yourself however we have used BPS security and if you are also using it,you can edit the .htaccess files in it using the htaccess file editor.

Compress Components

Compressing things always ends up making them smaller and load faster, so implementing some form of compression on your components is a must. This optimization step might not work for you if your server does not have either mod_deflate or mod_gzip installed as part of Apache.

(Visited 57 times, 1 visits today)

Leave a Comment.