HOW-TO generate a 404.html at the root of a Multilingual project with defaultContentLanguageInSubdir = true

If you want to output a 404.html at the root of a domain in a multilingual Hugo project with defaultContentLanguageInSubdir = true, then simply set the url parameter with a forward slash at the beginning, so that Hugo outputs the page under the host root, even if the project uses defaultContentLanguageInSubdir = true

e.g. url = "/404.html"

Ref: With defaultContentLanguageInSubdir: true, a 404.html file should be created at the root · Issue #5161 · gohugoio/hugo · GitHub

cc: @throdoproudfoot