Functions

redirect

redirect from next/navigation stops rendering or handler execution through a framework exception. Server Actions use a 303 response, ordinary non-streamed contexts normally use 307, and streaming can require a client-side redirect. Do not swallow the exception; use an allowlisted destination. For a Client Component event handler use the router instead. Source: https://nextjs.org/docs/app/api-reference/functions/redirect. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.

Formal Syntax & Structure

nextjs syntaxnextjs
redirect(path)

Working Example

Example Snippetnextjs
import {redirect} from 'next/navigation';export default function OldCatalog(){redirect('/catalog');}
Next.js Reference