-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
Redirect requests to default language URI in secondary languages to the custom secondary language slug #3550
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Not stale |
This issue has been automatically marked as stale because it has not had recent activity. This is for us to prioritize issues that are still relevant to our community. It will be closed if no further activity occurs within the next 14 days. If this issue is still relevant to you, please leave a comment. |
I am not convinced that this behavior is normal, it is rather very strange. I don't know it from other CMS. Maybe you could make it so that you can turn off the behavior if you don't want it? |
@schokomeldra I think there is a misunderstanding. This is not about pages with mixed translation texts or missing translations, but about canonical URLs to translated pages. At the moment, you can reach the exact same translated page via different combinations of nested paths (with the original slug and the translated slug of each level). By redirecting all invalid/inconsistent paths to the canonical path, users will still get to the correct page but with the correct URL. |
I've just stumbled across the same problem! I agree with you, the behavior should be exactly as you described: |
Same here. As a workaround, I added the following code to my $correctUrl = $page->url();
$requestPath = $kirby->path();
if (
strpos($correctUrl, $requestPath) === false &&
strpos($correctUrl, '/error') === false // don't redirect to /error -> keep wrong uri if not exist
) {
// keep query string if it exists
$query = $_SERVER['QUERY_STRING'] ? "?" . $_SERVER['QUERY_STRING'] : "";
return $kirby
->response()
->redirect($correctUrl . $query);
} Works for me, but use it with caution - I'm new to Kirby & PHP |
Thank you @Vincenius. I'll take a look at it und test it! |
Basic example
URLs:
Request mapping right now:
Expected behavior:
The last three examples should be
HTTP 302
redirects to the canonical URL/de/seite/unterseite
.Complex example
This works at the moment and there needs to be a unit test to verify that we don't break this behavior.
URLs:
Expected routing:
Background context
See #2257.
The text was updated successfully, but these errors were encountered: