Title: Filename based asset cache busting
Author: benlumley
Published: <strong>24 marca, 2016</strong>
Last modified: 27 aprila, 2020

---

Search plugins

![](https://ps.w.org/filename-based-asset-cache-busting/assets/banner-772x250.png?
rev=2292252)

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://ps.w.org/filename-based-asset-cache-busting/assets/icon-256x256.png?
rev=2292252)

# Filename based asset cache busting

 By [benlumley](https://profiles.wordpress.org/benlumley/)

[Download](https://downloads.wordpress.org/plugin/filename-based-asset-cache-busting.zip)

 * [Details](https://sl.wordpress.org/plugins/filename-based-asset-cache-busting/#description)
 * [Reviews](https://sl.wordpress.org/plugins/filename-based-asset-cache-busting/#reviews)
 * [Development](https://sl.wordpress.org/plugins/filename-based-asset-cache-busting/#developers)

 [Support](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/)

## Description

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

Just works.

#### Flywheel

Just works.

#### PHP Fallback

If your webserver is failing to serve assets using url rewriting, the plugin attempts
to serve them itsef (ie: via PHP). Obviously this is slow/less than ideal in production(
it’ll be much slower) – so you should configure your web server correctly to serve
the files. If you see this HTTP header “FBACB-Php-Fallback: yes” on your assets,
this applies to you.

Note that hosts are increasingly configured to serve css/js directly from disk and
won’t fall back to PHP + WordPress error handling – this fallback then won’t work.

## Reviews

![](https://secure.gravatar.com/avatar/b2636d2a5257aadb4cb9bc26df8cddf61636dc595e1bd3c6dbf463d2ba746246?
s=60&d=retro&r=g)

### 󠀁[Great Plugin to avoid hitting ctrl+f5 after every change in css and js file](https://wordpress.org/support/topic/great-plugin-to-avoid-hitting-ctrlf5-after-every-change-in-css-and-js-file/)󠁿

 [Sumit P](https://profiles.wordpress.org/sumit_p/) 27 junija, 2019

I was looking for something like Laravel’s Elixir Cache bursting solution and found
this plugin. Works great. To use this in nginx, add below line inside the server
block of your site’s nginx configuration # Support for Filename-based asset cache
busting Plugin location ~* \.(?:css|js)$ { if (!-e $request_filename){ rewrite ^/(.
+)\.([0-9\.]+)\.(js|css)$ /$1.$3 break; } }

![](https://secure.gravatar.com/avatar/1789084fde3e5938b7cf1d1c69e0ffb87b34c6012624c1910bd8c540d1677b05?
s=60&d=retro&r=g)

### 󠀁[Very useful and simple](https://wordpress.org/support/topic/very-useful-and-simple-8/)󠁿

 [neomobil](https://profiles.wordpress.org/neomobil/) 22 oktobra, 2017

Very useful and simple plugin. Should be the first one to choose. Thank you!

![](https://secure.gravatar.com/avatar/6a864fbf455e5ee6903e10a35597142f7e5c65de03166dad2747f4d86542a50e?
s=60&d=retro&r=g)

### 󠀁[Great plugin!](https://wordpress.org/support/topic/great-plugin-13573/)󠁿

 [loseveny](https://profiles.wordpress.org/loseveny/) 19 aprila, 2017

Thanks for making this, simple, easy use and powerful! it helps me lot.

![](https://secure.gravatar.com/avatar/c0dc7bb18d5c14e0586dd87fc9adf97d7cb6055417e1caa845cfdded2cfa3233?
s=60&d=retro&r=g)

### 󠀁[plugin is a lifesaver](https://wordpress.org/support/topic/plugin-is-a-lifesaver/)󠁿

 [James Maiden](https://profiles.wordpress.org/reallygreenjames/) 3 aprila, 2017

If you run a site that users browser caching, and you should, you should also be
using some kind of cache busting. This plugin make it easy.

![](https://secure.gravatar.com/avatar/819c1fcbd522899813c183f0a5c820e38598031bfaa62cd5bb9a44b500d6c2b0?
s=60&d=retro&r=g)

### 󠀁[works as advertised](https://wordpress.org/support/topic/works-as-advertised-388/)󠁿

 [bobhhh](https://profiles.wordpress.org/bobhhh/) 10 januarja, 2017

works as advertised

 [ Read all 5 reviews ](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/)

## Contributors & Developers

“Filename based asset cache busting” is open source software. The following people
have contributed to this plugin.

Contributors

 *   [ benlumley ](https://profiles.wordpress.org/benlumley/)
 *   [ Dominik Schilling ](https://profiles.wordpress.org/ocean90/)

[Translate “Filename based asset cache busting” into your language.](https://translate.wordpress.org/projects/wp-plugins/filename-based-asset-cache-busting)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/filename-based-asset-cache-busting/),
check out the [SVN repository](https://plugins.svn.wordpress.org/filename-based-asset-cache-busting/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/filename-based-asset-cache-busting/)
by [RSS](https://plugins.trac.wordpress.org/log/filename-based-asset-cache-busting/?limit=100&mode=stop_on_copy&format=rss).

## Meta

 *  Version **1.4**
 *  Last updated **6 let ago**
 *  Active installations **200+**
 *  WordPress version ** 3.0.1 or higher **
 *  Tested up to **5.4.19**
 *  Language
 * [English (US)](https://wordpress.org/plugins/filename-based-asset-cache-busting/)
 * Tags
 * [asset](https://sl.wordpress.org/plugins/tags/asset/)[assets](https://sl.wordpress.org/plugins/tags/assets/)
   [css](https://sl.wordpress.org/plugins/tags/css/)[JS](https://sl.wordpress.org/plugins/tags/js/)
   [version](https://sl.wordpress.org/plugins/tags/version/)
 *  [Advanced View](https://sl.wordpress.org/plugins/filename-based-asset-cache-busting/advanced/)

## Ratings

 5 out of 5 stars.

 *  [  5 5-star reviews     ](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/)

## Contributors

 *   [ benlumley ](https://profiles.wordpress.org/benlumley/)
 *   [ Dominik Schilling ](https://profiles.wordpress.org/ocean90/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/)