fix(redirects): exclude API routes from www redirect
The redirect was being applied to ALL routes including API routes, causing them to return "Redirecting..." instead of executing. Use negative lookahead regex `/((?!api).*)` to exclude /api/* paths from the www → non-www redirect. This ensures: - API routes execute normally without redirection - Page routes still redirect from www.tpmjs.com to tpmjs.com - Follows Option 2 from the investigation plan 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9be3af7427
commit
c42bfb684c
1 changed files with 2 additions and 2 deletions
|
|
@ -6,14 +6,14 @@ const nextConfig: NextConfig = {
|
|||
async redirects() {
|
||||
return [
|
||||
{
|
||||
source: '/:path*',
|
||||
source: '/((?!api).*)',
|
||||
has: [
|
||||
{
|
||||
type: 'host',
|
||||
value: 'www.tpmjs.com',
|
||||
},
|
||||
],
|
||||
destination: 'https://tpmjs.com/:path*',
|
||||
destination: 'https://tpmjs.com/$1',
|
||||
permanent: true,
|
||||
},
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue