How to enable Leverage browser cache in Wordpress?

bhawanisingh

Administrator
Staff member
If you want to speed up your Wordpresswebsite then you have to either you can download Wordpress cache plugin or you can add expires headers in .htaccess file.
Let's see how to add Expires headers for your wordpress website:
  • Login to cpanel.
  • Click on "File Manager" under "Files" section.
  • If you are not able to find your .htaccess file then you have to enable the "Show hidden files" option.
  • You can see the setting icon in your file manager, you have to click on it and then check the box "Show Hidden files".
  • Click on "Ok".
  • Now you are able to check all the .(dot) files in your file manager.
  • Go to "Public_html" file and click on edit .htaccess file.
  • You can add below code at the end of your .htaccess file.
Code:
<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 1 year"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 year"
ExpiresByType audio/x-wav "access plus 1 month"
ExpiresByType audio/mpeg "access plus 1 month"
ExpiresByType video/mpeg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/quicktime "access plus 1 month"
ExpiresByType video/x-ms-wmv "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresDefault "access 1 month"
</IfModule>
  • Save changes.
 
Top