Hi, i try setup redirects in netlify.toml, but have some problems.
Expected behaviour:
user with any browser language must be redirected to english version .com/en/
user with “ru” browser language must be redirected to .com/ru/
Current behaviour:
All users redirected to /en/
My netlify.toml (I inserted it whole so that there is more information):
[[redirects]]
from = "/register"
to = "https://domain.tld/register"
[[redirects]]
from = "/login"
to = "https://domain.tld/login"
[[redirects]]
from = "/"
to = "/ru/"
conditions = {Language = ["ru"]}
[[redirects]]
from = "/"
to = "/en/"
PS. I tried setup redirects within _redirects file but it not worked at all
Thanks for giving it a try. We do have a number of issues around language based redirects and have an issue tracking this. We’ll update this post if and when we get the issue with language based redirects fixed.
We need to redirect / to /en if language is english, and / to /fr if language is french. By default, we want to redirect to /en if no language is matched. Is there a way to achieve this? Currently everything is redirected to /en.
Our current netlify.toml:
[[redirects]]
from = "/"
to = "/fr/"
status = 302
conditions = {Language = ["fr"]}
[[redirects]]
from = "/"
to = "/en/"
status = 302
@francois_levesque I believe what most people do is have the site load the /en site by default, without a redirect and then use redirects for the cases where you do want it to redirect.
Also, how many languages are you sending in your requests that you’re using to test? if you can share the HAR file for one of your failed requests, that would be beneficial.