Configuration
Configuration redirects
Define an async redirects function returning rules with source, destination and permanent. A temporary rule returns 307; a permanent rule returns 308. Both preserve the original HTTP method. Test destination support and avoid redirect loops. The example changes only an old public catalog URL. Source: https://nextjs.org/docs/app/api-reference/config/next-config-js/redirects. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.
Formal Syntax & Structure
nextjs syntaxnextjs
async redirects()Working Example
Example Snippetnextjs
import type {NextConfig} from 'next';const config:NextConfig={async redirects(){return [{source:'/old-books',destination:'/catalog',permanent:true}];}};export default config;