feat: ai.zhuig.com 根路径重定向到后台管理
This commit is contained in:
+7
-1
@@ -5,6 +5,12 @@ export default withAuth(
|
|||||||
function middleware(req) {
|
function middleware(req) {
|
||||||
const token = req.nextauth.token;
|
const token = req.nextauth.token;
|
||||||
const path = req.nextUrl.pathname;
|
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)暂不对外开放:需登录后访问
|
// 行业情报(/community)暂不对外开放:需登录后访问
|
||||||
if (path.startsWith("/community")) {
|
if (path.startsWith("/community")) {
|
||||||
@@ -77,5 +83,5 @@ export default withAuth(
|
|||||||
);
|
);
|
||||||
|
|
||||||
export const config = {
|
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*"],
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user