diff --git a/src/middleware.ts b/src/middleware.ts index a099114..f757e18 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -5,6 +5,12 @@ export default withAuth( function middleware(req) { const token = req.nextauth.token; const path = req.nextUrl.pathname; + const host = req.headers.get("host") || ""; + + // ai.zhuig.com 根路径 → 重定向到 /admin + if (host.startsWith("ai.zhuig.com") && path === "/") { + return NextResponse.redirect(new URL("/admin", req.url)); + } // 行业情报(/community)暂不对外开放:需登录后访问 if (path.startsWith("/community")) { @@ -77,5 +83,5 @@ export default withAuth( ); export const config = { - matcher: ["/admin/:path*", "/api/user/:path*", "/api/admin/:path*", "/community/:path*", "/api/community/:path*"], + matcher: ["/", "/admin/:path*", "/api/user/:path*", "/api/admin/:path*", "/community/:path*", "/api/community/:path*"], };