Bug #97324
openCSS / JS files not referenced correctly when concatenation and compression are disabled
0%
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...
"
Updated by Marco Kuprat about 2 years ago
- Project changed from 9 to TYPO3 Core
- TYPO3 Version set to 11
- PHP Version set to 7.4
Updated by Česlav Przywara about 2 years ago
A bit off topic: where did you get that config.baseURL
is deprecated?
Looking at 11.5 docs, I don't see any deprecation being mentioned: https://docs.typo3.org/m/typo3/reference-typoscript/11.5/en-us/Setup/Config/Index.html#baseurl
Updated by Marco Kuprat about 2 years ago
That's right, "deprecated" is the wrong wording.
But with the possibility of site management since TYPO3 9 there's normally no need for config.baseURL
anymore.
My frontend was OK without config.baseURL
when the site was running TYPO3 10.4. But after the upgrade to TYPO3 11.5 it crashed and I regard setting config.baseURL
as workaround.
Of course, you could also add preceding slashes to page.includeCSS and page.includeJS in order to solve the problem.
But on the other hand I don't see a requirement for that in the docs.
So, all in all I regard this as a bug or at least missing documentation.
Updated by Arne Bracht over 1 year ago
- Related to Bug #99135: page.includeCSS with resource from fileadmin, the beginning slash is missing TYPO3 11.5.19 added
Updated by Knut E. about 1 year ago
A bit off topic: where did you get that
config.baseURL
is deprecated?
deprecated in TYPO3 Version 12.1
so the question for me what to do: the effect ist still in TYPO3 11.5.26: Add a Slash at the beginning of the files or is there another solution?
Updated by Knut E. about 1 year ago
a possible Solution via site:base from siteconfiguration
page = PAGE
page.headTag.append = TEXT
page.headTag.append.dataWrap = <base href="{site:base}">
Updated by Riccardo De Contardi 9 months ago
Knut E. wrote in #note-6:
so the question for me what to do: the effect ist still in TYPO3 11.5.26: Add a Slash at the beginning of the files or is there another solution?
Is there a reason not to write directly:
page.includeJS.myjs = /fileadmin/myjs.js
?
Updated by Riccardo De Contardi 9 months ago
- Related to Bug #82574: Inconsistent support of config.absRefPrefix in fluid/extbase added