When a Next.js Pages Router application defines any rewrite rule, production hydration triggers an additional client-side render for all routes, including those not affected by the rewrite. This is caused by a global flag that enables rewrite-aware reconciliation unconditionally, rather than only for requests whose route or query actually diverge due to a rewrite.
Origin Analysis
The Pages Router client bundle includes a global `hasRewrites` flag derived from the project's Next.js config. During hydration, a `useEffect` (or equivalent router lifecycle) checks this flag and, if true, unconditionally performs a post-hydration reconciliation of query and route state. Because the flag is global, every route—even `/` when only `/rewritten -> /target` is configured—triggers a state update on the Router context, causing the entire application tree to re-render. The reconciliation is only needed when the effective `asPath` differs from the resolved `route` or when rewrite-derived query parameters are present; for routes where both match, the extra render is redundant.
1. Clone https://github.com/gurkerl83/next-pages-router-global-rewrite-rerender-repro
2. Run `pnpm install && pnpm build && pnpm start`
3. Open `/` directly or reload `/` in production
4. Observe browser console: `_app` logs two client renders on `/`
5. Open `/rewritten` directly or reload `/rewritten`
6. Observe browser console: `_app` also logs two client renders on `/rewritten`