Project

General

Profile

Actions

Feature #97671

open

File versioning in query string

Added by Ian Solo over 2 years ago. Updated 4 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Frontend
Start date:
2022-05-22
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

File versioning in query string

If configured, automatically add a query string parameter to files URI in HTML. The string could be an MD5 hash generated from file content.
Example: https://domain.ext/fileadmin/logo.svg?4857383

Purpose of this feature

TLDR: improve SEO and browser's cache control.

It's good practice to serve resources that don't change often with a far-future expiration date.
Examples:
  • ExpiresByType text/css "access plus 1 year"
  • ExpiresByType text/javascript "access plus 1 year"
  • ExpiresByType image/jpeg "access plus 1 month"
  • ExpiresByType image/svg+xml "access plus 1 month"
  • ExpiresByType image/webp "access plus 1 month"
  • ExpiresByType font/woff2 "access plus 1 month"

If these resources change and we want that visitors' browsers get the new version, we have to manually change the file name.

TYPO3 processed files will automatically use a filename based on the file hash and configuration.
This current feature solves the browser cache problem but doesn't work for static files or files that are not processed like SVG.

Also, about SEO, if a search engine indexes a processed image like logo_86ebcdde02.jpg and this image changes, this old image's URI becomes 404. Instead, if the image is indexes with a URI like logo.jpg?123456, the old image URI is still 200.

References

https://simonhearne.com/2022/caching-header-best-practices/
https://web.dev/http-cache/
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Apache_Configuration_htaccess#cache_expiration

Actions

Also available in: Atom PDF