Handle missing routes at the right layer
Use the framework's documented not-found mechanism for application routes and the hosting platform's configuration for static files or edge routing. Confirm direct requests and browser refreshes reach that handler, not just in-app navigation.
Keep the page useful and lightweight: offer search, a link to a relevant section, or a way back without guessing what the visitor intended. Avoid redirecting every unknown path to the homepage, which can obscure the original missing URL.
Verify status, rendering, and discovery
Request a known missing path and check both the displayed page and HTTP status. Test language-prefixed URLs and nested routes because routing fallbacks can behave differently across path shapes.
Monitor recurring 404s for outdated internal links or removed pages, then fix the source or add a deliberate redirect where an equivalent destination exists. Keep true missing pages at 404 so reports remain actionable.