Subfolder on Next.js
Serve the blog at yourapp.com/blog straight from next.config — works self-hosted or on any Node host.
First enable Settings → Subfolder hosting in the dashboard. Then add rewrites — Next.js proxies them server-side, so readers never leave your domain.
next.config.jsmodule.exports = {
async rewrites() {
return [
{
source: "/blog",
destination: "https://you.blogcms.app/_subfolder/index.html",
},
{
source: "/blog/:path*",
destination: "https://you.blogcms.app/_subfolder/:path*",
},
];
},
async redirects() {
return [
{ source: "/blog/", destination: "/blog", permanent: true },
];
},
};
- Deploy your app, publish the blog once, then hit Verify setup.
- Hosting the Next.js app on Vercel? The Vercel guide's vercel.json works too — pick one, not both.