What is a browser cache?
The browser cache also know as client-side caching is one of the caching technique that temporary store files downloaded by your browser to display websites in your computer. Files that are cached locally may contains various documents that renders to display as a website, such as html files, CSS style sheets, JavaScript scripts, as well as graphic images and other multimedia content.
Why do you require enabling browser cache to your website?
In today’s world time is a prime factor that controls our patient, if your website loads slower then you lose your customers. So to make your website faster caching is very important.
By placing the below code to your .htaccess file will instruct your browser to cache the files with duration information that is the validity of your file.
Enable Browser Caching
# Setup 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 5 months"
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 5 days"
</IfModule>
Leave a Reply Cancel reply