An EE plugin for generating cache-busting URLs
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Cache Override

An EE plugin for generating cache-busting URLs.

Cache Override allows you a flexible means of adding a cache-busting timestamp to your assets, using a customizable pattern parameter.

Cache Override works a lot like EE's built-in {path} variable in that it outputs a URL based on the provided path, but it comes with a few extra features:

  • Using the pattern parameter, you can define how the filename should be rewritten. This also allows you to employ the "revving the filename" technique, placing the timestamp as part of the filename itself, instead of in a query string on the end of the URL.
  • The absolute_url parameter gives you the option of an absolute URL (because let's face it, some of us just prefer absolute URLs). (Note: the absolute URL will be based on what you've set as the site URL in your EE configuration.)
  • Because Cache Override's output is only the URL, it can be used to rewrite the filename of any asset you need to cache-bust—CSS, JavaScript, images, JSON, whatever.



  • path — URL path to the file, including filename and extension. This will be scrubbed in the process, so you can start it with a leading slash or a dot-slash if you want, it will end up just fine.


  • pattern — Default: {f}.{t}.{e}; a string (with placeholders) to determine what your new filename will look like. Placeholders include:

    • {t} - timestamp
    • {f} - filename (without extension)
    • {e} - extension (without preceding dot)
  • absolute_url — Default: false; if set to true, the output will be just like EE's own {path} variable, but the filename will be altered according to the defined pattern.

  • cdn — Default: null; a CDN domain you want prepended to the cachebusted output.


Basic Usage

{exp:cache_override path="assets/css/styles.min.css"}



Pattern parameter

{exp:cache_override path="/assets/css/styles.min.css" pattern="v-{t}.{f}.{e}"}



Absolute URL Parameter

{exp:cache_override path="./assets/css/styles.min.css" absolute_url="true"}




{exp:cache_override path="./assets/css/styles.min.css" cdn=""}



  1. I've only tested this on EE 2.9.2, but I don't imagine it breaking on anything from 2.5 and up.
  2. If the path parameter points to a non-existent file, the resultant request will (most likely) fail. I decided to keep this behavior in place, rather than have the plugin default to the original filename, as a way to gently push you to make sure you're using the cache-busted version of your file.

Learn more about cache busting: