🚨 Custom 404 Page in Next.js

📌 Steps to Create 404 Page

  • 📁 Inside app/, create a file named not-found.tsx or not-found.jsx.
  • ✅ This will be used as the default fallback for undefined routes.
  • 🎨 You can fully customize the 404 design and content.

⚠️ Specific Route Error Page

If you want to show custom messages for certain paths like /error/anything, use a catch-all route.

  • 📁 Create a folder: app/[...errorPage]/
  • 📝 Inside it, create page.jsx
  • 📝 Customize it to display an error message.
  • ✅ Use params.errorPage to show the dynamic segments