- Header.tsx: remove "SIGN IN" and "REGISTER" buttons from the top utility bar and the mobile drawer. Auth for PR firms / writers lives at distribution.relevantmediaproperties.com now; the local /client-login and /register routes are no longer the right entry point. - src/middleware.ts (new): 301-redirect /wp-login, /wp-login.php, /wp-admin, /wp-admin/*, /login, /client-login, and /register to https://distribution.relevantmediaproperties.com/login so existing bookmarks and old WP-era links land somewhere useful instead of 404. - Newsletter signup form, social icons, country selector all retained. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
950 B
TypeScript
40 lines
950 B
TypeScript
import { NextResponse, type NextRequest } from "next/server";
|
|
|
|
// PR firms / writers authenticate at the distribute platform, not here.
|
|
// Anything that looks like a WordPress login or the bare /login path
|
|
// redirects there so old bookmarks don't dead-end.
|
|
const AUTH_TARGET = "https://distribution.relevantmediaproperties.com/login";
|
|
|
|
const REDIRECT_PATHS = new Set<string>([
|
|
"/login",
|
|
"/wp-login",
|
|
"/wp-login.php",
|
|
"/wp-admin",
|
|
"/client-login",
|
|
"/register",
|
|
]);
|
|
|
|
export function middleware(req: NextRequest) {
|
|
const path = req.nextUrl.pathname;
|
|
if (
|
|
REDIRECT_PATHS.has(path) ||
|
|
path.startsWith("/wp-admin/") ||
|
|
path.startsWith("/wp-login/")
|
|
) {
|
|
return NextResponse.redirect(AUTH_TARGET, 301);
|
|
}
|
|
return NextResponse.next();
|
|
}
|
|
|
|
export const config = {
|
|
matcher: [
|
|
"/login",
|
|
"/wp-login",
|
|
"/wp-login.php",
|
|
"/wp-admin/:path*",
|
|
"/wp-login/:path*",
|
|
"/client-login",
|
|
"/register",
|
|
],
|
|
};
|