Bug #19149
closedInter domain linking with typolinkEnableLinksAcrossDomains does not work for domain record on root page
0%
Description
Considering the following setup with multiple domains:
+ root (domain A, siteroot)
|
-- Subsite (domain B, siteroot)
| |
| -- Subpage
|
-- Some Page
|
-- Other Page
Even with typolinkEnableLinksAcrossDomains enabled, the links from the Subsite (domain B) back to domain A don't work.
In class.tslib_content.php (5324) there is a check, if the linked page shares a root page with the current page. It does! The newly added if for is_siteroot is not considered, because it is checked after the rootline. So the domain record for domain A will not be used!
I think a setup like the one mentioned above is quite common and desirable. Swapping the two if-statements solves the problem. But now for every link from a page in domain A to another page in domain A the domain record will be found, so it must be checked if adding the domain is necessary in the URL.
class.tslib_content.php (5324):
if ($tCR_data['is_siteroot']) {
// Possibly subdomain inside main domain. In any case we must stop now because site root is reached.
break;
}
if ($tCR_data['uid'] == $GLOBALS['TSFE']->tmpl->rootLine0['uid']) {
$tCR_flag = 1; // OK, it was in rootline!
break;
}
Don't generate unnecessary absolute urls:
class.tslib_content.php (5364):
if ($urlParts['host'] == '' && (t3lib_div::getIndpEnv('HTTP_HOST') != $tCR_domain)) {
$LD['totalURL'] = 'http://' . $tCR_domain . ($LD['totalURL']{0} == '/' ? '' : '/') . $LD['totalURL'];
}
(issue imported from #M9046)
Files
Updated by Tobias Liebig about 15 years ago
attached patch (_v5) is pending in core list.
Caching issue must be solved: We need to add the HTTP_HOST to the caching identifier
Updated by Ernesto Baschny about 15 years ago
I wouldn't do that, Tobi, as HTTP_HOST comes from the user and cannot be trusted.
Rather I would drop the dependency on HTTP_HOST to decide if we need a domain prepended or not. See my post in the core list about that.
Updated by Tobias Liebig about 15 years ago
attached the current revision (pending in corelist) of the patches.
Using the HTTP_HOST in the cache identifier is indeed no good idea.
patch_9046_v8b_cacheIssue.patch solves the caching issue by using the domainStartPage (id where the domainrecord lies).