-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-language redirects #2435
Comments
Bumping this up: I can confirm it is still happening in 1.6.27. I have a multi-language website ( redirects:
/foo/(\d+): /bar/$1 But they do with the following: redirects:
(/.*)?/foo/(\d+): /bar/$2 I expected the first to work, as the documentation mentions:
InvestigationI noticed there was a big refactor in Grav 1.5 around multi-language redirects, perhaps explaining why OP had it working in prior versions. I tried to skim through it, but couldn't make out how the changes would impact matching source URL with language prefixes. Instead, I had a look at the grav/system/src/Grav/Common/Page/Pages.php Lines 537 to 556 in 75cb4e3
As we can see, it tries to match redirect source So I tried to use Thus, the question is: why are regex redirects and routes relying on |
Multilang redirects and routes were not working due to language prefixes being included in URL when trying to match source URL and redirect/route source pattern. Using `$route` parameter fixes the issue as given route does not include language prefixes (coming from `$uri->path()` in `PagesServiceProvider`). Fixes getgrav#2435.
Multilang redirects and routes were not working due to language prefixes being included in URL when trying to match source URL and redirect/route source pattern. Using `$route` parameter fixes the issue as given route does not include language prefixes (coming from `$uri->path()` in `PagesServiceProvider`). Fixes getgrav#2435.
I agree that based on the documentation, your proposal seems to be the better choice. |
We've got a live site running 1.3.1 which has the re-direct
/about-us/company: /about-us
. Our new site has an upgraded version of Grav (I've tried 1.5.10 and also 1.6-rc4).On the old site that re-direct would match for all languages i.e. only the slug part is important - as per the docs (https://learn.getgrav.org/15/content/routing#site-level-routes-and-redirects). On the upgraded site however, whilst the root https://example.com/about-us/company redirects it no longer matches the language versions i.e. https://example.com/en-gb/about-us/company and https://example.com/en-us/about-us/company
If I modify the redirect to use
/en-(gb|us)/about-us/company: /about-us
it does correctly redirect.Not sure if the logic has changed in this area - but any help you could give would be very much appreciated!
The text was updated successfully, but these errors were encountered: