# Create Top-Level 404 Page for a Multilingual Hugo Site

**URL:** https://discourse.gohugo.io/t/create-top-level-404-page-for-a-multilingual-hugo-site/47311
**Category:** tips & tricks
**Created:** [December 1, 2023, 1:20pm UTC](https://discourse.gohugo.io/t/create-top-level-404-page-for-a-multilingual-hugo-site/47311 "2023-12-01T13:20:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![CyrusYip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cyrusyip/32/20786_2.png) [@CyrusYip](https://discourse.gohugo.io/u/CyrusYip)
#### Post date: [December 1, 2023, 1:20pm UTC](https://discourse.gohugo.io/t/create-top-level-404-page-for-a-multilingual-hugo-site/47311/1 "2023-12-01T13:20:10Z")

</div>

If you build a multilangual Hugo site, you may want to enable `defaultContentLanguageInSubdir` to make URLs look consistent. For example:

- `/en/post/an-english-post`
- `/cn/post/a-chinese-post`

As of Hugo v0.120.4, `defaultContentLanguageInSubdir = "true"` still has the side effect that [no 404 page (404.html) is generated at the root of `public` directory](https://github.com/gohugoio/hugo/issues/5161), which causes [Cloudflare Pages to redirect non-exstent pages to root `/`](https://community.cloudflare.com/t/non-existent-page-doesnt-return-an-error-directs-to-root-page/394554). `404.html` at the root is needed to fix the problem.

There are three workarounds: reuse `404.html` in a subdirectory, create `404.md`, and create custom `404.html` in `static` directory.

> **[Create Top-Level 404 Page for a Multilingual Hugo Site](https://cyrusyip.org/en/post/2023/11/06/hugo-top-level-404/)**
>
> If you build a multilangual Hugo site, you may want to enable defaultContentLanguageInSubdir to make URLs look consistent. For example: /en/post/an-english-post /cn/post/a-chinese-post As of Hugo v0.120.4, defaultContentLanguageInSubdir = "true"...
