Configuration
Configuration rewrites
Return a simple rewrite array or phase-specific beforeFiles, afterFiles and fallback arrays. A rewrite serves the destination while retaining the visible request URL. Choose the phase deliberately; test collisions with files and dynamic routes. Do not use an untrusted external destination. Source: https://nextjs.org/docs/app/api-reference/config/next-config-js/rewrites. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.
Formal Syntax & Structure
nextjs syntaxnextjs
async rewrites()Working Example
Example Snippetnextjs
import type {NextConfig} from 'next';const config:NextConfig={async rewrites(){return [{source:'/shelf',destination:'/catalog'}];}};export default config;