Bug #93240
closedMultiTree concept for one domain not properly working with routing
100%
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:
- http://master.typo3.local/translated-fr-subsite-title/fr/
- http://master.typo3.local/translated-it-subsite-title/it/
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
Updated by Riccardo De Contardi almost 4 years ago
- Category set to Site Handling, Site Sets & Routing
Updated by Gerrit Code Review over 3 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70572
Updated by Gerrit Code Review over 3 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70572
Updated by Gerrit Code Review about 3 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70572
Updated by Gerrit Code Review about 3 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70572
Updated by Helmut Hummel about 3 years ago
Torben Hansen wrote:
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.
Wouldn't it also work, when configuring all language base with a language code?
Otherwise the definition is ambiguous and the result cannot be determined because of the that.
If anything I'd add a validation and error message for such configuration.
Or am I missing something here?
Updated by Helmut Hummel about 3 years ago
Helmut Hummel wrote in #note-8:
Wouldn't it also work, when configuring all language base with a language code?
I'd even say, that having multiple sites with the same base is misconfiguration given how routes are generated based on sites and languages.
The configuration advertised here creates 4 routes with the same host/path, resolving to different sites. How should a resolver, which only gets host and path as input deterministically resolve to a specific site?
Or to ask differently:
Which routes do you expect to be generated from such TYPO3 site configurations?
And can we be sure that no other routes make sense (or could have been meant) for the same TYPO3 site configurations?
Updated by Helmut Hummel about 3 years ago
- Status changed from Under Review to Needs Feedback
Updated by Gerrit Code Review about 3 years ago
- Status changed from Needs Feedback to Under Review
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70572
Updated by Stefan Busemann almost 3 years ago
Helmut Hummel wrote in #note-8:
Torben Hansen wrote:
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.
Wouldn't it also work, when configuring all language base with a language code?
Otherwise the definition is ambiguous and the result cannot be determined because of the that.
If anything I'd add a validation and error message for such configuration.Or am I missing something here?
Most Customers (and I have for this Szenario more then three) want to have a base domain without any language code and different options for regions as in this ticket required. So having a language code for every language is not preferred solution. This patch may not be the most elegant solution. But it works. Any other technical solution is welcomed to, but the issue should be solved. Since TYPO3 9 our customers lost a lot of flexibility for multilang / multi domain solutions. This patch would bring one solution back.
Updated by Gerrit Code Review almost 3 years ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70572
Updated by Oliver Hader about 2 years ago
- Sprint Focus set to On Location Sprint
Updated by Gerrit Code Review about 2 years ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76464
Updated by Gerrit Code Review about 2 years ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76464
Updated by Gerrit Code Review about 2 years ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76464
Updated by Gerrit Code Review about 2 years ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76464
Updated by Oliver Hader about 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset adc8b4402393668b6a148b736e46c692e88ed7e5.
Updated by Gerrit Code Review about 2 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76513
Updated by Gerrit Code Review about 2 years ago
Patch set 2 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76513
Updated by Gerrit Code Review about 2 years ago
Patch set 3 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/76513
Updated by Oliver Hader about 2 years ago
- Status changed from Under Review to Resolved
Applied in changeset bfc11bca0217a574dd9f913c6fa09f4aebd143bf.
Updated by Oliver Hader about 2 years ago
- Related to Bug #99149: Apply previous site identifier as fallback for URL resolving added
Updated by Benni Mack almost 2 years ago
- Status changed from Resolved to Closed