---
title: "Return true 404s with notFound()"
description: "A route that renders an empty template with status 200 is a soft 404: crawlers index it and users see nothing. Call notFound() when a record is missing or the slug is invalid, add app/not-found.tsx for the layout, and confirm the response status over HTTP. Keep redirects for moved content and reserve notFound() for genuinely absent pages."
url: "https://seo-mcp.io/t/return-true-404s-with-notfound"
---

# Return true 404s with notFound()

A route that renders an empty template with status 200 is a soft 404: crawlers index it and users see nothing. Call notFound() when a record is missing or the slug is invalid, add app/not-found.tsx for the layout, and confirm the response status over HTTP. Keep redirects for moved content and reserve notFound() for genuinely absent pages.

## Prerequisites

- Next.js project with dynamic routes that can receive unknown ids
- A not-found page that matches the site layout

## Steps

1. **Find the soft-404 routes** — Look for dynamic routes that render a shell when the record query returns nothing, and check the HTTP status of a deliberately invalid slug.
   Check: curl -sI your production domain/<dynamic-route>/does-not-exist returns 200 before the fix.
2. **Call notFound() on missing data** — Import notFound from next/navigation and call it when the record is absent or invalid, before rendering any content.
   Check: The same invalid slug now returns 404 after rebuilding.
3. **Add or fix app/not-found.tsx** — Create a not-found page with a short explanation, a link home and navigation, and no indexable content that competes with real pages.
   Check: The 404 response renders the not-found layout with a link home.
4. **Keep redirects for moved content** — Move slugs that changed to redirect rules and leave notFound() for genuinely absent records. Re-check Search Console for soft 404 reports after deploy.
   Check: A moved slug redirects to its new URL, while an unknown slug returns 404.

## Source

@seo-mcp on 2026-10-19: https://nextjs.org/docs/app/api-reference/functions/not-found

Canonical: https://seo-mcp.io/t/return-true-404s-with-notfound
