Redirect translation not working as expected.

Created on 29 March 2024, 3 months ago
Updated 30 March 2024, 3 months ago

Problem/Motivation

I have a website contains 3 lanuages domian.com/en domian.com/de domian.com/pl
I have also 3 prefixes /en /de /pl
My default language is /en. I also have a turn on detection language by browser.
So if user has a german language browser then home page redirect to domain.com/de

I need to add some redirects from legacy website where default language was de and without any prefix.

So if I want redirect from legacy page and create 3 redirect:
/companier (german version) into /de/companier (my new url) and selected language german
/en/companier (eng version) into /en/company (my new url) and selected language english
/pl/companier (pl version) into /pl/firma (my new url) and selected language polish
then redirect only find first one /companier because /en and /de prefix are removed in RedirectRequestSubscriber in method

$path = $this->pathProcessor->processInbound($request->getPathInfo(), $request);

So this solution doesn't work for me because only works first redirect to /de/companier

So I decided to put something like bellow:
/companier into /de/companier for german version (selected language german)
/companier into /en/company for english version (selected language english)
/companier into /pl/firma for polish version (selected language polish)

or i can do the same only put one redirect for all languages
/companier into /en/company but chose (all language)

and it magical works but only for english and polish version. For german version it redirect depends on browser detection so if I have a english browser then it redirect to /en/company but if I have a german version then redirect will be ok.

I noticed also when I change my prefixes in configuration admin/config/regional/language/detection/url for example /en into /eng /de into /deu and /pl into /pol then it works as expected.

$path = $this->pathProcessor->processInbound($request->getPathInfo(), $request);

I don't understand why it works like that and how can I do it without any modification from my new website. Maybe any different module or change some configuration for this module.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland crafter

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024