WPThumbs
Themes Plugins By purpose By industry Best-of lists Fix it guides
Free Plugin by benlumley v1.4

Filename based asset cache busting

Filename based cache busting for WordPress scripts/styles using last modified date.

Filename based asset cache busting

The facts

Rating
5★ from 5
Active installs
200+
Price
Free
Last updated
27 Apr 2020
Added
Mar 2016
Requires WP
3.0.1
Tested up to
WP 5.4.21
Downloads
10,642

Our analysis

AI-assisted

Filename based asset cache busting is a WordPress plugin that automatically updates the URLs of CSS and JavaScript files based on their last modified date. This helps prevent issues with cached files, ensuring that users always receive the latest versions without needing to refresh their browsers manually.

The plugin modifies the .htaccess file to implement these changes and offers a query string option as a fallback. It is designed for users looking to improve their site's performance and Google Pagespeed scores by managing asset caching effectively.

Best for: This plugin is suitable for WordPress site owners who want to improve asset management and site performance.

What it does well

  • Automatically updates asset URLs based on modification time
  • Reduces the need for users to manually refresh their browsers
  • Enhances caching strategies for improved performance
  • Includes support for both Apache and Nginx web servers

Where it falls short

  • Limited information on compatibility with specific web hosts
  • Some hosts may require custom configuration

Verdict

Filename based asset cache busting offers a straightforward solution for managing cached assets in WordPress. It is particularly useful for those seeking to enhance site speed and user experience.

From the developer

benlumley's own description of Filename based asset cache busting, lightly tidied.

Filename based cache busting for WordPress scripts/styles using last modified date.

Stop telling clients or users to hard refresh / shift refresh. The url to all of the css/js files on your site will change automatically whenever the files are modified. You can set proper long cache lifetimes to help get top scores on Google Pagespeed without running into cached css/javascript problems.

Based on this gist https://gist.github.com/ocean90/1966227 from Dominik Schilling, I’ve enhanced it by automatically replacing the asset version with the files modification time and automatically editing htaccess – making it install + forget.

Includes querystring option as a fallback – which works in more scenarios.

Webservers

Apache

The plugin should add what it needs to your .htaccess file jsut like WP itself. But if for any reason that doesn’t work for you – here’s what it adds:

# FBACB
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.+)\.([0-9\.]+)\.(js|css)$ $1.$3 [L]
</IfModule>

# still fbacb
<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType text/css                            "access plus 1 year"
    ExpiresByType application/javascript              "access plus 1 year"
</IfModule>
# END FBACB

Nginx

 location ~* ^(.+)\.(?:\d+)\.(min.js|min.css|js|css)($|\?.*$) {
   try_files $uri $1.$2;
 }

Host specific notes

Some webhosts need a bit of custom config to get the filename based urls working.

WP Engine

To work on WP-Engine, you’ll need the following redirect added via my.wpengine -> installname -> Redirect rules

 Source: ^(.+)\.([0-9\.]+)\.(js|css)$
 Dest: $1.$3
 Type: break (this is under advanced)

CloudWays

Read the full description on the official page →

Tagged as

Alternatives

Other plugins for making sites fast.

WP-Optimize

Get caching and more with this powerful cache plugin. Cache, optimize images, clean your database and minify f...

Free 1M+ installs 4.8★ (2,606)
LiteSpeed Cache

All-in-one unbeatable acceleration &amp; PageSpeed improvement: caching, image/CSS/JS optimization...

Free 7M+ installs 4.8★ (2,764)
EWWW Image Optimizer

Comprehensive image optimization with WebP, AVIF, Lazy Load, and more. Optimize images automatically for Faste...

Free 1M+ installs 4.8★ (1,838)
Under Construction

Easy to use Under Construction Page &amp; Coming Soon Page. Enable Under Construction Mode in seconds &amp; sh...

Free 600k+ installs 4.8★ (1,285)
Smush

Smush

93

Compress and optimize images, enable lazy load, serve WebP &amp; AVIF, and speed up your site with a global im...

Free 1M+ installs 4.8★ (6,051)
Converter for Media

Speed up your website by using our WebP &amp; AVIF Converter. Optimize images and serve WebP and AVIF images i...

Free 500k+ installs 4.9★ (1,097)