Fix “Use Efficient Cache Lifetimes” in WordPress – Simple .htaccess Solution (Copy & Paste)

If you run a WordPress website, you already know how important speed is. A fast site gets more clicks, more leads, and better rankings. When I checked one of my sites on Google PageSpeed Insights, I saw a warning:

“Use efficient cache lifetimes”
“A long cache lifetime can speed up repeat visits to your page.”

This warning means your site is not telling browsers to cache files for a long time. So every time a user opens your website, the browser downloads everything again. That makes your website slower.

I faced this issue, tested many fixes, and finally found a simple solution. I’m sharing it here so you can save time and fix it in minutes.


Why This Issue Happens

Google wants your website to use browser caching. This tells the browser how long files like images, CSS, JS, fonts, and icons should be stored locally.

If your server does not set a cache lifetime, PageSpeed Insights gives the “Use efficient cache lifetimes” warning.

This is common on:

  • Shared hosting
  • Apache servers
  • Old WordPress installs
  • Sites without caching plugins

The good news?
You can fix it with one small code block.


The Fix: Add Browser Caching Rules in .htaccess

To fix this, all you need to do is add a clean caching rule inside your website’s .htaccess file.

Steps:

  1. Log in to cPanel or FTP
  2. Open public_html
  3. Find .htaccess
  4. Add the code below at the bottom
  5. Save the file
  6. Clear cache or run PageSpeed again

That’s it. Your warning should disappear just like mine did.


Copy & Paste This .htaccess Code (Safe & Tested)

This is the exact code I used.
It works on Apache servers, which most WordPress sites use.

# BEGIN Browser Caching
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 month"
    ExpiresByType video/mp4 "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType application/x-javascript "access plus 1 month"
    ExpiresByType font/woff "access plus 1 year"
    ExpiresByType font/woff2 "access plus 1 year"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresByType application/pdf "access plus 1 month"
</IfModule>

<IfModule mod_headers.c>
    <FilesMatch "\.(jpg|jpeg|png|gif|webp|ico|pdf|mp4|svg)$">
        Header set Cache-Control "max-age=31536000, public"
    </FilesMatch>
    <FilesMatch "\.(css)$">
        Header set Cache-Control "max-age=2592000, public"
    </FilesMatch>
    <FilesMatch "\.(js|mjs)$">
        Header set Cache-Control "max-age=2592000, public"
    </FilesMatch>
    <FilesMatch "\.(woff|woff2|ttf|otf|eot)$">
        Header set Cache-Control "max-age=31536000, public"
    </FilesMatch>
</IfModule>
# END Browser Caching

This activates Expires Headers and Cache-Control, which is exactly what Google PageSpeed checks for.


Why This Fix Works

This .htaccess snippet tells the browser:

  • Images can stay cached for 1 year
  • Fonts can stay cached for 1 year
  • CSS and JS can stay cached for 1 month
  • SVG and PDFs get a shorter cache time

Google loves this because it reduces repeat downloads.
Your users love it because the site opens faster the next time they visit.


After Adding This Code – What Happens?

Here’s what you’ll notice:

✔ The “Use efficient cache lifetimes” issue goes away
✔ PageSpeed scores increase
✔ Repeat visits load much faster
✔ Lower server load
✔ Better user experience

This single fix might give you a 10–20 point boost on mobile speed.
It did for me.


Common Questions

Is this safe to add in .htaccess?

Yes.
I used it on my own WordPress site, and it’s 100 percent safe.

Will it break my site?

No. This code only adds browser caching rules.
It does not touch themes, plugins, or core files.

Do I need a caching plugin?

You can use one, but this .htaccess rule works even without plugins.

Does it work on NGINX?

No, NGINX uses a different config file (nginx.conf).
This code is only for Apache servers.


Final Thoughts

If your WordPress website shows the “Use efficient cache lifetimes” warning, this is one of the fastest fixes you can apply.
I personally faced this issue, tested different methods, and this .htaccess solution worked instantly.

Feel free to copy the code, use it on your site, and bookmark this page for future use.
ShashiDesign.com focuses on quick WordPress fixes that save you hours of testing and frustration.

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *

How to Speed Up Your WordPress Website 🚀 How to Turn Your Blog into a Passive Income Source