Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Fix "Leverage Browser Caching" in WordPress

This guide shows you how to clear the speed-test warning "Leverage browser caching" and make your site load faster for return visitors.

WordPress2 min read17 steps10 screenshots

What is browser caching?

A cache is a place that keeps a saved copy of something. Your browser is the program you use to open websites, like Chrome or Firefox. When someone visits your site, the browser saves pictures, styles and scripts on their device. Next time, it uses the saved copies instead of downloading them again. The page opens faster.

The warning appears when your site does not tell browsers how long to keep these files. You fix it by setting an expiry time. Think of it as a "best before" date on food.

Warning: A mistake in .htaccess can cause a 500 error. Download a copy of the file first.

Method 1: Use a caching plugin

A plugin is an add-on program for WordPress. Many speed plugins can set browser caching for you. Examples are W3 Total Cache, WP Super Cache and LiteSpeed Cache. Ask Hostvento support which one suits your plan.

  1. Log in to your WordPress dashboard.
    Screenshot: Log in to your WordPress dashboard.
  2. Click Plugins, then Add New.
  3. Search for the caching plugin you picked.
  4. Click Install Now, then Activate.
  5. Open its settings page.
  6. Look for an option named Browser Cache. Turn it on.
  7. Save and clear the plugin cache.

Method 2: Edit the .htaccess file

The .htaccess file is a hidden settings file on the Apache web server.

  1. Log in to your hosting control panel.
  2. Open File Manager and go to public_html.
    Screenshot: Open File Manager and go to public_html .
    Screenshot: Open File Manager and go to public_html .
  3. Turn on Show Hidden Files.
  4. Download .htaccess to keep a copy.
  5. Right-click it and choose Edit.
    Screenshot: Right-click it and choose Edit .
    Screenshot: Right-click it and choose Edit .
    Screenshot: Right-click it and choose Edit .
    Screenshot: Right-click it and choose Edit .
  6. Paste the code below at the very top.
    Screenshot: Paste the code below at the very top.
    Screenshot: Paste the code below at the very top.
  7. Save the file.
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>

This tells browsers to keep pictures for a year and styles and scripts for a month. If your server does not support this module, the rules do nothing. Ask Hostvento support if your plan uses a different web server.

Check the result

  1. Clear your plugin cache.
  2. Run your site through a speed test tool again.
  3. Check that the warning is gone.
Tip: After you change a style file, visitors may still see the old one. Clear caches and rename the file or change its version number.

Quick recap

  • Browser caching saves files on the visitor's device.
  • The warning means no expiry time is set.
    Screenshot: The warning means no expiry time is set.
  • A caching plugin is the easy fix.
  • You can add expiry rules to .htaccess. Keep a copy first.