In this tutorial, you will learn how to enable Leverage Browser Caching for Images, CSS and JS on your website. Once enabled, browser caching will allow visitors to save items from your web page so that they do not need to be downloaded every time they visit your website.
This is useful for design elements such as CSS stylesheets and media content such as images. It is a practical solution as when someone uploads an image that doesn’t change very often to their website.
This reduces bandwidth and increases page loading times.
How to Enable Leverage Browser Caching
To enabling browsing caching, all you need to do is add this code to 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 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 2 days" </IfModule> ## EXPIRES CACHING ##
That’s it. Now you know how to enable Leverage Browser Caching for your website.
If you are a ChemiCloud customer, we have you covered. Leverage Browser Caching is enabled by default on all our web hosting plans.