Standard 08 of 30 · Transport, Crawling & Discovery
HTTP Status Codes
Three-digit standardized server responses (200 OK, 301/308 Permanent Redirect, 302/307 Temporary Redirect, 404 Not Found, 410 Gone, 5xx Server Error).
Reviewed
Engineering Purpose
Communicates exact resource availability and canonical routing state to browsers and crawlers.
Browser & Search Relevance
Crawlers rely on true 404/410 codes to prune dead URLs and 301/308 redirects to transfer canonical signals.
Correct Implementation Patterns
- Use permanent 301/308 for moved routes and invoke notFound() for unknown dynamic slugs
import { notFound } from "next/navigation";
if (!record) notFound(); // Returns HTTP 404Next.js App Router Considerations
- Provide app/not-found.tsx and call notFound() whenever dynamic route lookups return undefined.
Common Errors
- Soft 404s returning HTTP 200 for nonexistent slugs
- Using 302 temporary redirects for permanent migrations
Testing Methods
- Automated status-code checks on valid, redirected, and nonexistent paths