How to enable cache expiry in WordPres using .htaccess file

Specifying cache expiry time for your site’s jpg, png, gif, css, html and java script files is simple but very effective way to improve your page speed score. Remember, page load time is very important for search engine optimization. You can simply do it with your .htaccess file.

So How Can I Add Cache Expiry Time In .htaccess?

First connect your site using FTP client like filezilla then download your .htaccess file and add below code at the top of the other code, now save and upload it back to your site.

## EXPIRES CACHING ##
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "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 month"
ExpiresDefault "access 1 month"
## EXPIRES CACHING ##

Was this post helpful?

Tags
Show More

Related Articles

Back to top button