Next.js · Middle · Question 53 of 75
How does a rewrite differ from a redirect in next.config.ts?
- ✓Correct answer: A rewrite serves another path's content while the browser URL stays the same; a redirect sends the browser to a new URL
- 2They are the same, but rewrites are permanent
- 3Rewrites work only for external URLs
Explanation
Rewrites act as a proxy, e.g. mapping /api/:path* to another backend or an old app during migration. The user never sees the destination URL.