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

---

Ricerca i plugin

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

Questo plugin **non è stato testato con le ultime 3 versioni principali (major releases)
di WordPress**. Potrebbe non essere più mantenuto, o supportato, e potrebbe presentare
problemi di compatibilità se utilizzato con versioni più recenti di WordPress.

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

# Filename based asset cache busting

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

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

 * [Dettagli](https://it.wordpress.org/plugins/filename-based-asset-cache-busting/#description)
 * [Recensioni](https://it.wordpress.org/plugins/filename-based-asset-cache-busting/#reviews)
 * [Sviluppo](https://it.wordpress.org/plugins/filename-based-asset-cache-busting/#developers)

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

## Descrizione

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.

## Recensioni

![](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 Giugno 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 Ottobre 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 Aprile 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 Aprile 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 Gennaio 2017

works as advertised

 [ Leggi tutte le recensioni di 5 ](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/)

## Contributi e sviluppo

“Filename based asset cache busting” è un software open source. Le persone che hanno
contribuito allo sviluppo di questo plugin sono indicate di seguito.

Collaboratori

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

[Traduci “Filename based asset cache busting” nella tua lingua.](https://translate.wordpress.org/projects/wp-plugins/filename-based-asset-cache-busting)

### Ti interessa lo sviluppo?

[Esplora il codice](https://plugins.trac.wordpress.org/browser/filename-based-asset-cache-busting/)
segui il [repository SVN](https://plugins.svn.wordpress.org/filename-based-asset-cache-busting/),
segui il [log delle modifiche](https://plugins.trac.wordpress.org/log/filename-based-asset-cache-busting/)
tramite [RSS](https://plugins.trac.wordpress.org/log/filename-based-asset-cache-busting/?limit=100&mode=stop_on_copy&format=rss).

## Meta

 *  Versione **1.4**
 *  Ultimo aggiornamento **6 anni fa**
 *  Installazioni attive **200+**
 *  Versione WordPress ** 3.0.1 o superiore **
 *  Testato fino alla versione **5.4.19**
 *  Lingua
 * [English (US)](https://wordpress.org/plugins/filename-based-asset-cache-busting/)
 * Tag
 * [asset](https://it.wordpress.org/plugins/tags/asset/)[assets](https://it.wordpress.org/plugins/tags/assets/)
   [css](https://it.wordpress.org/plugins/tags/css/)[JS](https://it.wordpress.org/plugins/tags/js/)
   [version](https://it.wordpress.org/plugins/tags/version/)
 *  [Visualizzazione avanzata](https://it.wordpress.org/plugins/filename-based-asset-cache-busting/advanced/)

## Valutazioni

 5 su 5 stelle.

 *  [  5 recensioni a 5-stelle     ](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/?filter=5)
 *  [  0 recensioni a 4-stelle     ](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/?filter=4)
 *  [  0 recensioni a 3-stelle     ](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/?filter=3)
 *  [  0 recensioni a 2-stelle     ](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/?filter=2)
 *  [  0 recensioni a 1-stelle     ](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)

[Vedi tutte le recensioni](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/reviews/)

## Collaboratori

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

## Supporto

Hai qualcosa da dire? Ti serve aiuto?

 [Chiedi nel forum di supporto](https://wordpress.org/support/plugin/filename-based-asset-cache-busting/)