Sitemap.xml is not working on the live server (Next.js)
kemodaypp
HOBBYOP

3 months ago

Hello 👋,

I’m trying to optimize my platform for SEO and created a sitemap.ts. On my local server, it works perfectly:

http://localhost:3000/sitemap.xml

But after deploying to production, this URL:

https://mydomain.com/sitemap.xml

returns a 404 error.

I suspect it might be related to server routing, build configuration, or dynamic route handling. My sitemap is generated programmatically in TypeScript—maybe the build isn’t including it or the server isn’t serving .xml routes correctly.

Has anyone faced a similar issue with Next.js / Node.js / static sitemap generation? Any tips on ensuring the sitemap is properly served in production would be greatly appreciated! 🙏

$10 Bounty

1 Replies

3 months ago

Is your sitemap.ts in the app/ directory? For App Router, it should be at app/sitemap.ts.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...