Issue Bug Closed

#97324CSS / JS files not referenced correctly when concatenation and compression are disabled

Marco Kuprat 04/07/22, 06:15 updated 03/20/25, 14:42

Description

After updating a site from TYPO3 10.4 to 11.5.8 I encountered following problem:
The frontend of subpages from level 2 got messed up, because CSS and JS files were not referenced correctly (loading those files resulted in a 404 error).

Example TypoScript setup in order to reproduce the error:

config.minifyCSS = 0
config.concatenateCss = 0
config.compressCss = 0
config.minifyJs = 0
config.concatenateJs = 0
config.compressJs = 0

page.includeCSS.mycss = fileadmin/mycss.css
page.includeJS.myjs = fileadmin/myjs.js

In TYPO3 11.5 the CSS and JS files are referenced like this:
@<link rel="stylesheet" type="text/css" href="fileadmin/mycss.css">
<script src="fileadmin/myjs.js?1570519026"></script>@

Whereas in TYPO3 10.4 they were referenced with a prepending slash:
@<link rel="stylesheet" type="text/css" href="/fileadmin/mycss.css">
<script src="/fileadmin/myjs.js?1570519026"></script>@

So on subpages like https://www.domain.xy/page-1/subpage-1-1/ the references lead to a 404 error.

Setting config.absRefPrefix = / (or any other values) in TypoScript does not help.
However it works when config.baseURL is set, but that is deprecated.
Also, the problem does not exist as soon as config.concatenateCss = 1 or config.compressCSS = 1 are set (JS respectively), because in that case the references look like “ /typo3temp/assets/compressed... “

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.