My redirect rules are processed and deployed without effect

Hello,

I have a simple HTML site (https://armands.site) which works fine, except for one thing:

If you open the site now, it seems as if it does not have actual content, but it has language specific content, in the hu and en folders. So I would like to redirect my visitors to the /hu one if my visitors com from Hungary and to the /en one if the come from elsewhere.

For that I wanted to use Netlify redirects in my netlify.toml file to have a centralised solution, so I wrote the following:

[[redirects]]
from = “/"
to = “/en/:splat”
status = 301
force = true
query = {path = “:path”}
conditions = {Language = [“en”]}
[[redirects]]
from = "/

to = “/hu/:splat”
status = 301
force = true
query = {path = “:path”}
conditions = {Language = [“hu”]}

I used the asterisk and the splat to match everything after the base URL, so https://armands.site/something would redirect to https://armands.site/en/something or https://armands.site/hu/something based on the actual location, but it does not seem to work, since the redirection is not happening.

What did I do wrong?

Thanks for your answer!

Armand

Hey @bozsikarmand,
It’s possible that you did everything right and are running into this issue:
https://answers.netlify.com/t/language-based-redirect-only-works-when-1-browser-language-set/4252/3
We don’t have updates on the fix at this point, but you might be able to accomplish the results you want with country-based redirects:

If it’s possible for you to set a language cookie using a language button in your interface somewhere (i.e., “Select language > Hu or En”), that would also be a good workaround- our language-based redirects using the cookie work much more reliably at this point. Let us know if you have any other questions!