If you have TYPO3 installed in a subfolder and a domain
record with that subfolder (localhost/subfolder/ for
example) TYPO3 only generates absolute links in the
frontend.
This is because the typoLink function compares the
HTTP_HOST var with the domainRecord. HTTP_HOST is in
this case "localhost", the domain record has the subfolder
attached. The subfolder needs to be there, as otherwise
t3lib_pageSelect::getDomainStartPage does not find the
start page anymore. typoLink should check for HTTP_HOST +
path of SCRIPT_NAME to determine which domain record
to use (same as getDomainStartPage already does).
Change-Id: I317a419cd4a898a0bfdeffec5d01417d92400b3e
Fixes: #33214
Releases: 4.5,4.6,4.7
Reviewed-on: http://review.typo3.org/7816
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
$GLOBALS['TYPO3_DB']->sql_free_result($res);
// Set targetDomain to first found domain record if the target page cannot be reached within the current domain
- if (count($foundDomains) > 0 && (!in_array($currentDomain, $foundDomains) || count($firstFoundForcedDomains) > 0)) {
+ if(
+ count($foundDomains) > 0 &&
+ (
+ (
+ !in_array($currentDomain, $foundDomains) &&
+ !in_array($currentDomain . trim(preg_replace('/\/[^\/]*$/', '', t3lib_div::getIndpEnv('SCRIPT_NAME'))), $foundDomains)
+ ) ||
+ count($firstFoundForcedDomains) > 0
+ )
+ ) {
foreach ($targetPageRootlinePids as $pid) {
// Always use the 'forced' domain if we found one
if (isset($firstFoundForcedDomains[$pid])) {