diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index c89c1b6..d56b2c6 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -1,7 +1,21 @@ import type { NextConfig } from 'next'; +// Old domains that only forward to a site's main domain (a 301 keeps whatever search ranking they had). +// The old domain still needs its DNS records and a bound certificate so the request reaches us. +const LEGACY_DOMAINS: Record = { + 'swingermatch.com': 'swingandscore.com', +}; + const config: NextConfig = { transpilePackages: ['@whatbox/core'], output: 'standalone', // small container image for Azure Container Apps + async redirects() { + return Object.entries(LEGACY_DOMAINS).map(([from, to]) => ({ + source: '/:path*', + has: [{ type: 'host' as const, value: `(?:www\\.)?${from.replace(/\./g, '\\.')}` }], + destination: `https://${to}/:path*`, + statusCode: 301 as const, + })); + }, }; export default config;