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
## EXPIRES CACHING ## <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" </IfModule> ## EXPIRES CACHING ##
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. 🙂