diff --git a/packages/next/server/on-demand-entry-handler.ts b/packages/next/server/on-demand-entry-handler.ts index 550fd09adb3f26..5227b88d9addd2 100644 --- a/packages/next/server/on-demand-entry-handler.ts +++ b/packages/next/server/on-demand-entry-handler.ts @@ -414,6 +414,11 @@ export function normalizePage(page: string) { if (unixPagePath === '/index' || unixPagePath === '/') { return '/' } + + if (!unixPagePath.startsWith('/')) { + return '/' + unixPagePath.replace(/\/index$/, '') + } + return unixPagePath.replace(/\/index$/, '') }