ALL SYSTEMS OPERATIONALUPTIME 99.97%FLEET 18/18IN-MUM · US-LAX · EU-FSN EST. 2003 · +91 11 4998 4038

KNOWLEDGEBASE · .HTACCESS

How to enable Leverage Browser Caching

Last updated 2024-11-28

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. To enable 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 ##

 

← All knowledgebase articles

Tell us what has to stay up.

A short conversation with an engineer. No quote-bot, no callback queue. We'll tell you honestly if we're not the right fit.