From 6f7c97ac8416929c85d901ab237952e57c63caf3 Mon Sep 17 00:00:00 2001 From: ysandler Date: Sun, 18 May 2025 11:39:14 -0500 Subject: [PATCH] feat: added Nextjs multi-tenant routing rewrites for path slugs and subdomain slugs --- next.config.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/next.config.js b/next.config.js index bcfc4c1..882a7bc 100644 --- a/next.config.js +++ b/next.config.js @@ -22,6 +22,20 @@ const nextConfig = { }, reactStrictMode: true, redirects, + async rewrites() { + return [ + { + source: '/((?!admin|api)):path*', + destination: '/:tenantDomain/:path*', + has: [ + { + type: 'host', + value: '(?.*)', + }, + ], + }, + ] + }, } export default withPayload(nextConfig, { devBundleServerPackages: false })