Next.js 13 Middleware: Redirect to Not Found 404 Page?
Unanswered
Grass carp posted this in #help-forum
Grass carpOP
In
What I have tried:
1. Calling
2. Calling
middleware.ts, doing some subdomain routing check and want to return a Not Found Page based on subdomain. What I have tried:
1. Calling
notFound(), doesn't work in middleware.2. Calling
NextResponse with rewrite or redirect actually needs a url. I don't want to host any of these Not Found pages on a route.1 Reply
@Grass carp In `middleware.ts`, doing some subdomain routing check and want to return a Not Found Page based on subdomain.
What I have tried:
1. Calling `notFound()`, doesn't work in middleware.
2. Calling `NextResponse` with `rewrite` or `redirect` actually needs a url. I don't want to host any of these Not Found pages on a route.
you can always rewrite to an non-existent url like
/404