Why does an unknown Next.js slug become a soft 404?
The route often returns 200 with a missing-content message or generic shell. Call notFound for absent records and make error pages clearly distinct from valid content.
Written for next.js teams investigating soft-404 reports for dynamic articles, products, profiles, or tool routes.
Key facts
- A soft 404 is a success response that search systems interpret as missing or low-value error content.
- Next.js notFound() invokes the route's not-found UI and 404 handling.
- A custom error message does not change a 200 status by itself.
A useful rule: make each important claim understandable and verifiable without requiring the reader to reconstruct your meaning from the rest of the page.
What creates the soft 404?
The dynamic route matches any slug, the content lookup returns undefined, and the component still renders its normal shell with 200. It may show a short “not found” paragraph, redirect visually with client code, or fill fields from defaults. Search systems compare the status with page content and can label this contradiction a soft 404. The fix begins at the server boundary: detect absence before rendering the detail page and invoke Next.js not-found handling rather than representing the error only inside visible copy.
- Inspect the raw HTTP status for random slugs.
- Remove fallback detail records.
- Handle absence before emitting metadata or schema.
What should notFound() change?
It should stop normal route rendering, select the nearest `not-found` component, and produce the framework's missing-page response. The resulting UI can keep site navigation, search, and relevant links, but it should not inherit a canonical to the invalid URL, Article or Product JSON-LD, or the missing title as if the page exists. Verify the actual deployed response because middleware, rewrites, and hosting adapters can alter status behaviour. A polished error design is useful only when the protocol status is also truthful.
- Test status, metadata, and body together.
- Keep recovery navigation without impersonating valid content.
- Remove detail-page structured data from errors.
When should an old slug redirect instead?
Redirect when a real page moved and a clear replacement preserves the same user intent. Use one permanent hop from the old slug to the new canonical URL and update internal links and sitemap entries. Return 404 or 410 when content was removed without a relevant substitute. Redirecting every unknown slug to the homepage creates another soft-404 pattern and confuses users. Maintain an explicit redirect map for known moves rather than guessing destinations from arbitrary paths.
- Redirect only known moved resources.
- Use one hop to the closest equivalent.
- Do not send arbitrary missing routes to the homepage.
Sources: 2
Could middleware hide the correct status?
Yes. Middleware can rewrite missing paths to a catch-all page, add authentication redirects, normalize locales incorrectly, or serve an edge fallback with 200. CDN custom-error settings can also replace bodies or statuses. Trace the request through middleware, route matching, application logs, and edge response. Test encoded slugs, trailing slashes, locale prefixes, uppercase variants, and suspicious extensions. Make URL normalization finite and redirect only to known canonical forms before content existence is evaluated.
- Audit middleware and platform error overrides.
- Test URL variants beyond one random string.
- Prevent rewrite loops and generic success fallbacks.
How should soft 404s be monitored?
Create a production test that requests random unknown paths under every dynamic route family and requires 404. Crawl the sitemap and internal links to ensure no published URL accidentally returns missing content. Review Search Console soft-404 examples, classify the route pattern, and fix the shared template rather than each reported URL. Preserve redirects for real migrations and monitor their destinations. The objective is a consistent contract: valid resources return complete 200 pages, known moves redirect once, and absent resources return an honest missing status. Keep examples in the regression suite.
- Continuously probe dynamic route families.
- Group reports by template cause.
- Cross-check discovery URLs against live content.
Put it to work
Find the highest-impact fix on your site.
Probe dynamic paths and compare response status with visible content, canonical tags, and schema.
Find soft 404 routesSources
- 1.Next.js documentation: App Router error handlingChecked 2026-07-26
- 2.Google Search Central: Troubleshoot crawling errorsChecked 2026-07-26