FullerPrime
FullerPrime
TTCTheo's Typesafe Cult
Created by FullerPrime on 9/30/2023 in #questions
How do I redirect using middleware?
I have a /signup page and I'm trying to get all client requests to redirect to that page. I've tried using next config and vercel without much luck, now trying with middleware Middleware looks like this: import { NextResponse } from 'next/server' import type { NextRequest } from 'next/server' export function middleware(request: NextRequest) { return NextResponse.redirect(new URL('/signup', request.url)) } export const config = { matcher: [ '/((?!signup|api|_next/static|_next/image|favicon.ico).*)', ], } This too, doesn't work. Located in the src folder. What am I missing here?
3 replies