What is a browser caching?
It is also important to know that every one of these files makes separate requests to the server, and more requests mean more time required to load the page. I believe now you know how it all relates to the overall page speed of a webpage.
What is the way out? Obviously, you must try to reduce the number of requests your web page makes to the server. You can do it by minimizing the number of images, CSS, JS or other elements on your website. But, what if you cannot avoid using them all? Well, in such a scenario, you need to make use of Browser Caching.
Browser caching can help you load the page comparatively faster by storing some of these files locally in your browser. However, it will not affect the page speed when a user visits your page for the first time. But, when they navigate to other page or come back again on your website after some time, the page will load faster, as you browser must already have cached some of the files locally.
Remember your browser does not do it effectively by itself, you will have to instruct them to make use of caching.
How to Leverage Browser Caching?
It is very simple if you are aware of FTP and .htaccess file on your web server. Log into the FTP account of your website and find the file named .htaccess. Download it and open with Notepad. Paste the following code:
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
## EXPIRES CACHING ##
Now save it and upload to the server, replacing the already existing version.