Home / Knowledgebase Home / How to Fix Browser Cache Showing Old Site Version

// View Comments //

How to Fix Browser Cache Showing Old Site Version

Introduction

Seeing an outdated version of your website even after updates? This is typically a client-side caching issue, known as browser cache showing an old site version, which occurs when browsers store cached files (e.g., CSS, JavaScript) instead of loading your latest changes. Common across all websites, from WordPress blogs to custom apps, this problem frustrates users and can impact SEO. Whether you’re a beginner refreshing a site or an intermediate user managing updates, this issue is fixable with simple tools. Our detailed guide offers step-by-step solutions using browser settings, hosting control panels, and server configurations. Let’s ensure your latest site version shines!

What Causes Browser Cache to Show an Old Site Version?

Browser caching saves website files locally to speed up loading, but an outdated cache can display old content. Common causes include:

  • Browser Cache: Browsers (e.g., Chrome, Firefox) store old CSS, JavaScript, or images after site updates.
  • Long Cache Expiry Headers: Server headers (e.g., Cache-Control: max-age=31536000) instructing browsers to cache files for months.
  • No Cache Busting: Static files (e.g., style.css) lacking versioned URLs (e.g., style.css?v=1.1) to force new loads.
  • CDN Caching: Content Delivery Networks (e.g., Cloudflare) serving cached versions of your site.
  • Caching Plugins: WordPress plugins (e.g., WP Super Cache) are not clearing cache after updates.
  • Server-Side Caching: Hosting server caching (e.g., LiteSpeed Cache) holding outdated files.
  • Service Worker Cache: Progressive Web Apps (PWAs) using service workers to cache old resources.
  • Network Cache: ISP or corporate network proxies caching old site versions.

Step-by-Step Fix

Follow these steps to resolve the issue, addressing all causes from client-side to server-side:

Clear Browser Cache

  • Google Chrome:
    • Press Ctrl+Shift+Delete (Windows) or Cmd+Shift+Delete (Mac).
    • Select “Cached images and files” and clear data for “All time.”
    • Reload your site with Ctrl+F5 for a hard refresh.
  • Firefox:
    • Press Ctrl+Shift+Delete, select “Cache,” and clear.
    • Reload with Ctrl+F5.

Test your site to confirm the latest version loads (e.g., check updated text or images). Alternatively, open your site in Incognito mode to bypass the cache.


Update Cache-Control Headers

  • Log into your hosting control panel (e.g., cPanel, DirectAdmin) and open File Manager.
  • Navigate to your site’s root directory (typically public_html) and edit the .htaccess file.
  • Add or modify cache-control headers for dynamic content:
    <IfModule mod_headers.c>
      <FilesMatch "\.(html|php)$">
        Header set Cache-Control "no-cache, no-store, must-revalidate"
      </FilesMatch>
      <FilesMatch "\.(css|js|jpg|png|gif)$">
        Header set Cache-Control "public, max-age=604800"
      </FilesMatch>
    </IfModule>
    

Save, right-click .htaccess, select Change Permissions, and set permissions to 644. Alternatively, via SSH: Edit .htaccess with nano .htaccess and set permissions with chmod 644 .htaccess.

Implement Cache Busting

  • For WordPress: Install a plugin like Autoptimize to add versioned URLs (e.g., style.css?ver=1.1).
  • Alternatively, in your theme’s functions.php:
    <?php
    function add_cache_busting($src) {
        return $src . '?ver=' . time();
    }
    add_filter('style_loader_src', 'add_cache_busting', 9999);
    add_filter('script_loader_src', 'add_cache_busting', 9999);
    ?>
    

For non-CMS sites: Append query strings to static files (e.g., <link href="style.css?v=1.1">) in HTML/CSS. Test your site to ensure new files load.

Clear CDN and Server-Side Cache

  • CDN (e.g., Cloudflare):
    • Log into your CDN dashboard and navigate to Caching > Purge Cache.
    • Select “Purge Everything” to clear cached files.
  • WordPress Caching Plugins:
    • Log into wp-admin, go to your caching plugin (e.g., WP Super Cache), and clear the cache.
    • Alternatively, in File Manager, delete cache files in wp-content/cache.
  • Server-Side Cache:
    • In your control panel, check for server caching (e.g., LiteSpeed Cache) and clear it.
    • Contact your hosting provider to flush server cache if needed.

Address Service Workers and Network Cache

  • For PWAs: Open Chrome Developer Tools > Application > Service Workers and unregister any active service workers.
  • Clear browser storage: Developer Tools > Application > Clear storage > Clear site data.
  • For network cache: Restart your router or switch to a different network (e.g., mobile data) to bypass ISP proxies.

Verify and Finalize

  • Hard refresh your site (Ctrl+F5) to confirm the latest version loads.
  • Check Developer Tools > Network to ensure files have updated timestamps or versioned URLs.
  • If the old version persists, contact your hosting provider for server-side caching issues.

Preventing Future Cache Issues

  • Set Short Cache Times: Use no-cache for dynamic content and reasonable max-age for static files.
  • Use Cache Busting: Always version static files after updates.
  • Monitor CDNs: Regularly purge CDN caches post-update.

Conclusion

Fixing browser cache showing an old site version is straightforward with this guide. By clearing caches, updating headers, and implementing cache busting, your site will display its latest version. Ready to run your site on autopilot? Migrate to VeeroTech today for a Free WordPress Performance Evaluation and Free Migration Service!

FAQs

Why does my browser show an old site version?

Browsers cache files to speed up loading, but an outdated cache shows old content.

How do cache-control headers help?

They instruct browsers on how long to cache files, preventing outdated displays.

Can WordPress plugins cause caching issues?

Yes, caching plugins like WP Super Cache may not clear after updates.

What is cache busting?

Adding versioned URLs (e.g., style.css?v=1.1) to force browsers to load new files.

Why does my CDN show old content?

CDNs cache files; purge the cache to serve updated versions.


If you have any web hosting questions please feel free to reach out to us. We're happy to help.

Shared Hosting | Reseller Hosting | Managed WordPress Hosting | Fully Managed VPS Hosting
Our Guiding Principles
Subscribe to comment notifications
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments