Next.js Discord

Discord Forum

Pages not being found in next js when deployed but are found locally

Unanswered
Champagne D’Argent posted this in #help-forum
Open in Discord
Champagne D’ArgentOP
So down below is my next.config.ts file

const nextConfig = {
distDir: 'out',
output: 'export',
images: { unoptimized: true },
}

export default nextConfig
I'm using the Next.js Pages Router with a structure like pages/friends/index.tsx everything works fine locally — hitting /friends in the browser loads the page no problem. But after deploying, navigating directly to the URL gives a 404. Interestingly, client-side navigation via useRouter from next/router works fine — it's only direct URL entry or hard refresh that breaks.

0 Replies