404.html page for the root while translation is used


That’s great to use Hugo, I really loved it and handled many cases with the docs. Thanks.

Now, I’m in a problematic situation that I can’t find a solution. Here is the details:

My Hugo website supports two languages in the different sub roots;

When someone visits my website mysite.ext, it redirects to the mysite.ext/en/ because my defaultContentLanguageInSubdir is true. In this case, 404.html problems happen for the GitLab pages service and maybe for the other services too.

I’m using GitLab pages as explained in the Hugo docs. When I go to a page that doesn’t exist on my website, let’s say mysite.ext/en/this-page-doesn-t-exist/, GitLab shows its own 404 pages, not mine… Because the 404.html files are located in the sub folders for each language (/en/404.html and /de/404.html, not in the root folder of whole website (/404.html), I guess the problem is that… Because if I make the defaultContentLanguageInSubdir; false, it shows 404 pages correctly, here is why; because in this case, Hugo locates the 404.html file in the root folder when I publish the website.

How can I handle this kind of problem?
I need your help.

Thread with solution : Global 404 page for a multilingual site