@dbzx10299 I’d imagine you cannot use the netlify.toml
for your redirects due to the system that you’re working with.
If you factor in the Rule processing order that I linked to:
Rules in the _redirects
file are always processed first, followed by rules in the Netlify configuration file.
Then consider that what you’re working with (nuxt
) is clearly appending its own rules to the bottom of a _redirects
file.
Nothing about Netlify’s systems moves rules between _redirects
and netlify.toml
, they’re two separate files that are processed in the order as above, first one, then the other.
Also:
The redirects engine will process the first matching rule it finds, reading from top to bottom.
Situation #1
When you’re putting your rule in the _redirects
, it’s being output by nuxt
as:
_redirects
----------
/foo /bar 301!
/sitemap.xml /.netlify/builders/server 200
/__nuxt_error /.netlify/functions/server 200
/* /.netlify/functions/server 200
Accessing /foo
will redirect to /bar
, as the rule has high priority it is easily found.
Situation #2
When you have the same rule in the netlify.toml
, factoring in processing you effectively end up with:
_redirects
----------
/sitemap.xml /.netlify/builders/server 200
/__nuxt_error /.netlify/functions/server 200
/* /.netlify/functions/server 200
netlify.toml
----------
/foo /bar 301!
The rules automatically appended by nuxt
now have a higher priority than the one in your netlify.toml
Accessing /foo
would be caught by /* /.netlify/functions/server 200
Your /foo /bar 301!
is never reached.
If you wanted to have all the rules in your netlify.toml
you would need to ensure they were all in their appropriate place in the netlify.toml
and nothing was producing the catch all rewrite in the _redirects
.