Looking for ways to optimize WordPress website speed, but even after multiple caching plugins you still get “static assets with an efficient cache policy” notification in Google PageSpeed Insights?
It’s actually quite simple to fix, even without any caching plugins. Here you’ll find detailed instruction how to deal with inefficient cache policy in just a few minutes.
How to serve static assets with an efficient cache policy in WordPress or WooCommerce
In order to serve static assets with an efficient cache policy you need to add specific code to your WordPress .htaccess file. You’ll find complete code below – it’s ready to use on any website. But first we need to find out how we’ll access tha file.
Where to locate and how to open .htaccess file in WordPress
There are few ways to get to .htaccess file. File itself is located in your hosting server – in the main WordPress directory – public or public_html It can be accessed via File manager tool in your hosting admin panel (Cpanel, Directadmin, Webmin, etc.).
If you can’t edit .htaccess via server admin panel, you may login to your server via FTP client (for example Filezilla), and edit the file there.
If you’re using Yoast SEO plugin, it has a way to edit .htaccess file directly in WordPress admin panel. Go to Yoast SEO >> Tools in WordPress admin panel, and open File editor.
Once you’re there you can edit .htaccess file content without any additional tools.
How to add code to serve static assets with an efficient cache policy
When you open .htaccess file, scroll to the end of it – until you’ll see line # END WordPress.
Add static assets code before it:
Final result should look like that:
Don’t forget to save changes after you update .htaccess file (and reupload modified file back to server if you’ll update it using FTP client).
No additional steps should be needed – next time you’ll check your WordPress website speed in PageSpeed Insights that static assets issue should be gone, and your website pagespeed should be improved, at least by few percent.
Looking for other ways to speed up WordPress website? Then you should check this post about best WordPress speed optimization plugins.