You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've renamed a few routes and would like to redirect the old route names to the new ones. However, since the alwaysRedirect is set to true, i18n picks up the current set locale and will add that to the route.
I've implemented the 301 at the top in the i18n middleware;
For example;
/sv/old/route
should 301 to;
/sv/new-route
But if locale en is already set in a cookie, it will add /en/ to the route, resulting in;
/en/sv/new-route
and a page not found.
What I would like is to have the locale set to sv and the route to be respected.
I've tried to add both paths in the page view. Tried to use the setLocaleCookie right before the redirect. But can't get it to work. It still redirects again and I get the Redirected when going from "/sv/old/route" to "/sv/new-route" via a navigation guard_ error.
The text was updated successfully, but these errors were encountered:
I'm not sure exactly how you want it to work since alwaysRedirect means that it will always try to redirect to the locale stored in the cookie. And that's regardless if you have renamed some routes or not. So it basically makes switching to a route from another locale impossible unless you manually setLocale or setLocaleCookie first.
If you want me to have a closer look then you should create a simple repro.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I've renamed a few routes and would like to redirect the old route names to the new ones. However, since the alwaysRedirect is set to true, i18n picks up the current set locale and will add that to the route.
I've implemented the 301 at the top in the i18n middleware;
For example;
/sv/old/route
should 301 to;
/sv/new-route
But if locale en is already set in a cookie, it will add /en/ to the route, resulting in;
/en/sv/new-route
and a page not found.
What I would like is to have the locale set to sv and the route to be respected.
I've tried to add both paths in the page view. Tried to use the setLocaleCookie right before the redirect. But can't get it to work. It still redirects again and I get the Redirected when going from "/sv/old/route" to "/sv/new-route" via a navigation guard_ error.
The text was updated successfully, but these errors were encountered: