Redirects settings as follows, the multilingual 404 pages work fine, but the fallback 404 page doesn’t work. Am I doing something wrong?
# multilingual 404 pages.
[[redirects]]
from = "/:lang/*"
to = "/:lang/404.html"
status = 404
# fallback 404 page.
[[redirects]]
from = "/*"
to = "/en/404.html"
status = 404
What do you mean by “doesn’t work”? (Displays a different 404 page, redirect loop, 5xx error …)?
It probably would also help the Netlify folks to mention you are using Hugo (at least I think I recognize you from the Hugo forums and presume that is the SSG which you are using).
While probably not the answer you’re looking for. the simplest thing is to duplicate the /en/404.html page to /404.html which Netlify would automatically serve for any invalid page.
invalid-page now acts as the :lang placeholder. So based on your rule, Netlify tries to look for /invalid-page/404.html, and that doesn’t exist. Thus, the default 404. The solution is to explicitly define all languages instead of relying on placeholders.