remove broken auth UI from header; PR firms now authenticate at distribute platform
- 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>
This commit is contained in:
39
src/middleware.ts
Normal file
39
src/middleware.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
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",
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user