Here is the brief explanation of Leverage Browser Caching and how to use it to improve website performance.
When a web browser i.e. Chrome, Firefox, Internet Explorer, Safari etc displays webpage it has to load several things like css files, javascript files, images and other resources.
What web browser caching does is that it remember the resources that the browser has already loaded. This means that when a user goes from one page to another page on the website it does not have to load all css files and other resources again because it already has "remembered" all resources. The outcome is that the web pages load much faster.
you can achieve this by adding some code to a file called .htaccess on your web host/server.
## EXPIRES CACHING ##
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"
## EXPIRES CACHING ##
Save the .htaccess file and then refresh your webpage.
You can change the cache time periods according to your requirement like "1 year" or "1 month".
0 Comment(s)