How to leverage browser caching?

While observing speed test of your website, you may often come across ‘Leverage Browser Caching’ thing. This is something accomplished by installing any popular caching plugin. But, you do not have to always depend on a plugin to achieve such a little task.

Login to your cPanel via FTP or hosting account. Find your .htaccess file in the root of your domain (public_html). This file is a hidden file but should show up in FTP clients like FileZilla. You can edit the .htaccess file with notepad or any form of basic text editor such as TextWrangler that you can get easily. Once you are ready, simply copy and paste the following piece of code intact:

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg “access plus 1 year”
ExpiresByType image/jpeg “access plus 1 year”
ExpiresByType image/gif “access plus 1 year”
ExpiresByType image/png “access plus 1 year”
ExpiresByType text/css “access plus 1 month”
ExpiresByType application/pdf “access plus 1 month”
ExpiresByType text/x-javascript “access plus 1 month”
ExpiresByType application/x-shockwave-flash “access plus 1 month”
ExpiresByType image/x-icon “access plus 1 year”
ExpiresDefault “access plus 2 days”

This will do the trick. Now your leverage browsing caching warning will get mitigated. And your website speed test results will be improved.