I recently migrated an application already published on netlify to next js. When performing the migration, the redirects stopped working even though there was no change in the configuration.
My _redirect file remains in the build folder and as follows =>
I have configured a next.js site at coelmay.org. I have created a redirect for go.coelmay.org => google.com.au such that all paths lead to the same endpoint i.e.
I am wondering if the first redirect rule in the file you provided is stopping the latter (the second rule will cover the first rule also so the first is technically not required.)
I just checked that it doesn’t seem like that redirect rule is forced. Are you sure you’ve added the ! like you show in the screenshot? You can try downloading the deploy to see if that’s what’s getting deployed. In your latest deploy, I am seeing that the redirect rules exist in the netlify.toml and not in the _redirects file - that might be done by the plugin, but the redirect rule is not being forced and that’s not expected. It does convert it correctly in most cases.
O! is added as shown in the image. I removed the toml file so we don’t have any doubts that the current settings are actually dressed in the _redirects file.
I downloaded the deploy and didn’t find the _redirects file, only the toml. I’m doing a new deployment for testing without the toml file.
After the last deploy with the deletion of my toml file, I verified that the _redirect file is not generated in the build. I downloaded the deploy to analyze and found only a toml file with several redirects from the next one, routes, but what I want to do is not present in the file, any idea how to solve it?
You have the _redirects file in the correct location. But you say you downloaded the last deploy and it wasn’t there. This doesn’t quite add up especially as the favicon.ico and rosa_seo.png files are navigable meaning they were copied.
I wasn’t suggesting you do anything, it was more an observation that two files that are in public are making it to the deploy while the third (_redirects) isn’t, which does not make sense.
Have you tried building the site locally? Does everything end up in the build directory (including _redirects)? If so, there is no reason (that I can think of) this wouldn’t happen when building on Netlify also.