Solve Leverage Browser Caching problem in WordPress via .htaccess

Everyone should always looking for the options to improve the Page Load speed of blogs or website. The easiest way in Wordpress is to improve the page load of blog or website is the leverage browser caching. It is very important to solve the leverage browser caching problem on the website other wise website or blog takes more time to load the page. Leveraging browser caching, can not reduce the number of HTTP requests that the server needs to process, but it is very useful for reducing the page load times and improving your website or blog performance. By solving the problem of leverage browser caching, we can improve our scores on PageSpeed and YSlow. Here in this post I am describing how we can solve the Leverage Browser Caching problem step by step.

Step 1. Finding .htaccess file

First of all it is very important to finding your website .htaccess file it should be on the root directory of the website where your WordPress is installed. If it is not there may be it is in the hidden form you can access it through the cpanel by selecting the “Show hidden files” option is checked.

Step 2. Now take the backup of your original .htaccess file and Copy and Paste the below code into the .htaccess file

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
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 image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
ExpiresByType text/x-javascript "access 1 month"

Step 3. Save and upload the .htaccess file on the same position means on the root directory where your WordPress is installed.

Now our main static files (images, CSS, PDFs, JS, etc.) will be cached and it will produce faster loading times in the future.

Thanks and enjoy the reading. 🙂