Issue Task Closed

#106394Use of SVGs within _asset Paths resolves to 404 due to missing SVG handling in default rewrite rule

cosmoblonde GmbH 03/19/25, 14:13 updated 12/02/25, 14:21

Description

When addressing an SVG file which is part of an extension’s Resources/Public/Images folder within a fluid template this results in a hash addition to the filename inside the extension’s _asset-folder.

E.g.: _assets/a7de3d8338e8a464bf8950e5191729d2/Icons/flags/de.1732119456.svg

Fluid-Code-Example:
<img width=“28” height=“19” class=“teaser__flag” loading=“lazy” src=”{f:uri.resource(path: ‘Icons/flags/{flagName}.svg’, extensionName: ‘my_extension’)}

The hash-value will be handled in the according rewrite rule that is part of the blueprint .htaccess template (vendor/typo3/cms-install/Resources/Private/FolderStructureTemplateFiles/root-htaccess)

But the SVG-type is missing in the rewrite rule (lines 304-306)

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.)\.(\d)\.(php|js|css|png|jpg|gif|gz)$ %{ENV:CWD}$1.$3 [L]

Changing the rule to:
RewriteRule ^(.)\.(\d)\.(php|js|css|png|jpg|gif|svg|gz)$ %{ENV:CWD}$1.$3 [L]

allows the hash to be handled and the SVG image is displayed.

It would be good if this rule can be added to the default root-htaccess template since SVGs are more and more common.

Reviews 4

History 48

  1. Gerrit Code Review pushed patch set 1 for main to change 88653 status New Under Review 03/20/25, 05:53

  2. Georg Ringer changed tracker Feature Task TYPO3 Version 12 03/20/25, 05:54

  3. Gerrit Code Review pushed patch set 2 for main to change 88653 03/20/25, 08:24

  4. Gerrit Code Review pushed patch set 3 for main to change 88653 03/21/25, 21:20

  5. Gerrit Code Review pushed patch set 1 for 13.4 to change 88682 03/22/25, 09:21

  6. Georg Ringer commented and changed status Under Review Resolved done 0 % 100 % 03/22/25, 09:25

    Applied in changeset commit:5cb7d01419231bf0d3a6c46d8d9e46e4d428e941.

  7. Oliver Bartsch changed Related to #106712 05/16/25, 07:08

  8. Benni Mack changed status Resolved Closed 12/02/25, 14:21