diff --git a/packages/twenty-website/next.config.ts b/packages/twenty-website/next.config.ts index e53746f4e8..20b81c8f91 100644 --- a/packages/twenty-website/next.config.ts +++ b/packages/twenty-website/next.config.ts @@ -101,12 +101,33 @@ const nextConfig: LinariaConfig = { async redirects() { return [ // Canonicalise www → apex. Host-based; fires before any locale logic. + // The root-path rule must come before the :path* one — Next.js's + // path-to-regexp leaves a literal `:path*` in the Location header + // when the parameter matches empty against an absolute destination. + { + source: '/', + has: [{ type: 'host', value: 'www.twenty.com' }], + destination: 'https://twenty.com/', + permanent: true, + }, { source: '/:path*', has: [{ type: 'host', value: 'www.twenty.com' }], destination: 'https://twenty.com/:path*', permanent: true, }, + { + source: '/', + has: [{ type: 'host', value: 'www.twenty-main.com' }], + destination: 'https://twenty-main.com/', + permanent: true, + }, + { + source: '/:path*', + has: [{ type: 'host', value: 'www.twenty-main.com' }], + destination: 'https://twenty-main.com/:path*', + permanent: true, + }, // Strip the source-locale prefix: /en/foo → /foo (301). Mirrors proxy.ts Rule 1. { source: '/en', destination: '/', statusCode: 301 }, { source: '/en/:path*', destination: '/:path*', statusCode: 301 }, diff --git a/packages/twenty-website/wrangler.jsonc b/packages/twenty-website/wrangler.jsonc index ac3c9279af..968d4a994a 100644 --- a/packages/twenty-website/wrangler.jsonc +++ b/packages/twenty-website/wrangler.jsonc @@ -16,7 +16,11 @@ "name": "twenty-website-dev", "routes": [ { - "pattern": "website.twenty-main.com", + "pattern": "twenty-main.com", + "custom_domain": true, + }, + { + "pattern": "www.twenty-main.com", "custom_domain": true, }, ],