How to Leverage browser caching to improve webpage load time performance & speed


To enable browser caching you need to set expiry dates on certain types of files.

Find your .htaccess file in the root of your domain. You can edit the htaccess file with notepad or any text editor.

In this file we will set our caching parameters to tell the browser what types of files to cache over period of time so that page loading time improves by avoiding or keeping certain files & using browser cache from history.

Now copy following code in you .htaccess file available at your website root:


## Leverage browser 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"

Hope it helps,

Thanks & Regards
Mandar Apte

Leave a Reply

Your email address will not be published. Required fields are marked *