Next.js Sites Often Serve Duplicate Pages; Canonical Setup Fixes Split Rankings
A single Next.js page can be reachable at several URLs, including www and non-www hosts, trailing-slash variants, query-string versions, and Vercel preview deployments. Search engines treat each as a separate document, which can divide inbound links and ranking signals across them. The recommended fix involves choosing one preferred domain and redirecting the others with permanent 308 redirects, either through Vercel's domain settings or middleware. Developers should also set a consistent trailing-slash policy in the Next.js config to avoid redirect chains and mixed internal links. Finally, canonical tags, with a base URL set in the root layout, tell search engines which version of a page is authoritative.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in