Redirects netlify.toml not working

Hi, @elie, I’ve tested this behavior and this is what I have found.

For clarity:

  • base directory = the build.base directory (the base directory for the Netlify build)
  • base of the repo = the base directory of the Git repo itself

If the netlify.toml file specifies a base then the build process starts over from that directory. However, this has a side effect of only processing the build.base setting itself. No other settings from that netlify.toml will be used.

There are several possible solutions for this. Some of those are:

  • have a second copy of the netlify.toml file with the required settings, including redirects, in the base directory
  • use a _redirects file in the publish directory (not the base directory) and have the redirects loaded from that file instead

Changing the base directory in netlify.toml also means the TOML file build command will not be used from that file. You must then either have a second netlify.toml file in the base directory which does contains the build command plus publish directory, the redirects, and any other settings required or those must be specified in the web UI settings for the site at Netlify.

I’d suggest the second netlify.toml file in most cases. There may be instances where you are better off setting these in the Netlify settings for the site in our web app though.

​Please let us know if there are other questions.