Search code examples
typo3typo3-7.6.xrealurl

Can't show included CSS and JS on subpages


On subpages, for example mysite.com/about/, CSS and JS are not working.

From page source:

<link rel="stylesheet" type="text/css" href="typo3conf/ext/news/Resources/Public/Css/news.css" media="all">

When I click the CSS link, it leads to

mysite.com/about/typo3conf/.../news.css

instead of

mysite.com/typo3conf/.../news.css

Using currently latest versions of:

  • realURL
  • t3sbootstrap

Solution

  • As realurl simulates a subdirectory, the pathes to the CSS and JS files, which are relative to webroot, are wrong.
    You either have to use

    config.baseURL = /
    

    or (preferrable) use

    config.absRefPrefix = /