Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

File Version

8 sites Security covered
View on drupal.org

This module adds a token to file URLs that changes when a file is modified. This improves caching by allowing CDNs and other systems to differentiate between old and new versions of the same file, especially useful for image styles. You can configure it to apply to all files or only image styles, and optionally whitelist or blacklist specific file extensions.

This module add simple token in files URLs based on file modified time. This is very useful for caching files in CDNs and differentiate if the image changes like a new resource.

Modules that crop images need this for integrate with CDNs. Because the image file name is the same but the image could be different.

You can configure:

  • Add token for image styles URLs
  • Add token for all files URLs
  • Define whitelist and blacklist of file extensions

HOW TO USE:
Go to /admin/config/media/file_version and check if you want use File Version All Files" or only "Image Styles".

  • If you choose "All Files": All files that internal use file_create_url() have file version token.
  • If you choose "Image Styles": All image styles follow system pattern have file version token (included external file system integration like s3fs module).

ADVANCED USE:
You can define a comma separated list to exclude or force files with a extension.

  • Blacklist: a extensions list to exclude, you must have checked File Version All Files" or for "Image Styles".
  • Whitelist: a extensions list to force include, is only thought for use with Styles" checked and add for example pdf extension to include these or for use with none checkbox checked to choose exactly your extensions.

Example file URL without File Version:
http://example.com/sites/default/files/2017-05/example.png

Example file URL with File Version:
http://example.com/sites/default/files/2017-05/example.png?fv=v-malxjm

IMPORTANT:

  • The module will generate absolute URLs for avoid encoding conflicts with GET query parameters.
  • The module use hook_file_url_alter(), so it works with core file/image workflow and all the files using file_create_url().

Activity

Total releases
2
First release
Feb 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Dormant

Releases

Version Type Release date
2.0.2 Stable Mar 5, 2025
2.0.1 Stable Feb 25, 2025