Project

General

Profile

Actions

Bug #93240

closed

MultiTree concept for one domain not properly working with routing

Added by Torben Hansen almost 4 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Site Handling, Site Sets & Routing
Target version:
-
Start date:
2021-01-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Site Handling & Routing
Complexity:
Is Regression:
Sprint Focus:
On Location Sprint

Description

When you have a TYPO3 website that handles exactly one domain for different languages, it is either possible to use a single tree which includes all languages or it is possible to configure one tree for each language (e.g. if the structure of the translated site strongly differs from the default language). Currently the last setup is not intuitively possible to archive, since there seems to be a bug in the SiteMatcher.

Scenario:

The domain http://master.typo3.local/ should be available in 4 languages.

  • German and english follow a strict translation (site1)
  • Danish only has a small subset of pages of the "main" site (site2)
  • French has a different page template and thus a different menu structure (site3)

3 sites are configured as shown on the following screenshot.

All 3 sites have http://master.typo3.local/ as entry point (base) and the appropriate language configuration with a base for each language.

Current behavior:

When opening http://master.typo3.local/, the website is shown in french (redirected to http://master.typo3.local/fr/). Expected is the german version of the website.

Problem location:

The SiteMatcher component uses the function getRouteCollectionForAllSites() to return a RouteCollection with possible sites for the current route. This function also uses the "main" entry point (without a language configuration) to resolve the route, so actually multiple matches for the "/" route will be determined. As seen on the screenshot below, actually all 3 sites will be considered to resolve the "/" route for the domain as shown on the debug output below.

Obviously, the last one "wins" when the Symfony UrlMatcher matches the rroute.

Possible solution:

getRouteCollectionForAllSites() should only add Sites the the RouteCollection, that also have a language. If I remove line 196 (https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/Routing/SiteMatcher.php#L196), everything works fine. Since a Site Object always seem to have at least a language, it is not really clear to my, why getRouteCollectionForAllSites() also tries to match routes for sites with no language.

However, if line 196 is removed, unit tests for SiteMatcher fail.

Why not move the language to the entry point base?

It is possible to work around this problem by moving the language specific base to the entry point base. This will however be a problem, if e.g. the french site becomes a "subsite" having multiple languages, where the subsite URL segment also must be translated.

Example:

As shown in the example, it will not be possible to translate the subsite title, when it is part of the entry point base.


Files

routes.png (48.2 KB) routes.png Torben Hansen, 2021-01-07 18:54
sites.png (44.7 KB) sites.png Torben Hansen, 2021-01-07 19:04

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #99149: Apply previous site identifier as fallback for URL resolvingClosed2022-11-21

Actions
Actions

Also available in: Atom PDF