Next.js

Updated: 7/14/2025, 10:19:28 AM

Next.js App routerで,Custom 404 pageにレイアウトを適用させない方法

7/14/2025, 10:19:28 AM

Layout.tsxは配置されているディレクトリの中身に適用される

not-found.tsxpage.tsxとで違うディレクトリにすれば良い.

→ 普通のディレクトリにいれるとルーティングされるので,論理グループを使う

app/ (default_site)/ /page.tsx about/page.tsx contact/page.tsx layout.tsx (error_layout)/ layout.tsx not-found.tsx components/ utils/

このように配置すればいい

参考 How to remove the Layout on 404 page