What I can read in the documentation doesn’t work in production or netlify dev
environment.
We are developing a multi-language website and I only find problems with redirects.
I cannot filter by language. This issue has open threads in the community since September/October 2019. We are at July 2020 and the problems continue.
My netlify.toml
[[redirects]]
from = "/"
to = "/es"
status = 302
force = true
conditions = {Language = ["es"]}
[[redirects]]
from = "/"
to = "/en"
status = 302
This works locally for Safari and Chrome, but in production it only works in Safari. Apparently in Chrome if you have multiple languages configured this redirect does not work and 80% of users use Chrome. By default my chrome browser has two languages: “es” and “es-ES”.
If I filter by country redirects works:
[[redirects]]
from = "/"
to = "/es"
status = 302
force = true
conditions = {Country = ["ES"]}
[[redirects]]
from = "/"
to = "/en"
status = 302
Now it works in all browsers but new problems appear. The EN version of the web is always loaded locally, because netlify-cli does not detect any country in the call locally. And another problem is that there are many countries where Spanish is spoken. Do I have to enter them all manually? This is crazy.
For language 404 redirects I have problems that look like “X files”.
With the same configuration, one site works for me and another does not.
I have set up a demo site: https://kind-kilby-b7673b.netlify.app/
This is the netlify.toml setting
[[redirects]]
from = "/"
to = "/es"
status = 302
force = true
conditions = {Country = ["ES"]}
[[redirects]]
from = "/"
to = "/en"
force = true
status = 302
[[redirects]]
from = "/es/*"
to = "/es/404/"
status = 404
[[redirects]]
from = "/en/*"
to = "/en/404/"
status = 404
Everything seems to be working properly.
When a 404 occurs, the redirection takes the user to the 404 error page corresponding to each language.
Now I have another site where we are working for a client.
The configuration of the redirects is exactly the same.
On this site Chrome does not load 404 by language and it gives an error in the redirection. Safari works correctly. These kinds of mistakes are a punishment. We chose Netlify precisely so as not to worry about these things.
This is the API Site ID: 7f6f22aa-bd63-4043-882b-334261daa271
I hope you can review what happens because nothing works as we hope. We have wasted many hours with this and we are quite disappointed. Especially knowing that these problems have existed since the end of 2019.
We wait for your answer.
Thank you.