For some reason my rewrites aren’t working? And it really doesn’t seem hard…
This is the rewrite part in my netlify.toml:
[[redirects]]
from = "/wedstrijden/:race"
to = "/races/:race"
status = 200
[[redirects]]
from = "/nl/wedstrijden/:race"
to = "/nl/races/:race"
status = 200
When I attempt to test this redirect, I’m getting a 401 unauthorized error when navigating to dev.andylemaire.be. Do you have some type of auth enabled on the site?
@modcarparking the strange thing is that all my redirects work perfectly (I have about 27 redirects) when using Netlify CLI to confirm everything locally. But after deploy the translated url’s don’t work, and the next one does work:
[[redirects]]
from = "/events/:event/:race"
to = "/races/:race"
status = 301
force = true
I have no extra spaces, my editor removes those. The target path does exist and as stated above, locally using Netlify CLI to test it, it’s all fine. I’m using Next.js but there are no rewrites/redirects in there. And I’ve cleared Netlify cache + browser cache 100 times…
Small update, I’m using Next.js also. I now expect that the Netlify rewrites don’t work in combination with Next.js but I can’t find documentation of the recent Runtime, only the Legacy Runtime.
Don’t know if this is the correct way, but I moved all rewrites/redirects to the Next.js config instead of netlify.toml. I always thought netlify.toml was preferred.
We do intend to provide another configuration option to change the behaviour though (so the Function would receive the new URL instead of the original one), however it’s currently not priorotised.