File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,29 @@ import { NextResponse } from "next/server";
22import type { NextRequest } from "next/server" ;
33
44export const config = {
5- runtime : "experimental-edge" ,
5+ matcher : [
6+ /*
7+ * Match all request paths except for the ones starting with:
8+ * - api (API routes)
9+ * - _next/static (static files)
10+ * - _next/image (image optimization files)
11+ * - favicon.ico (favicon file)
12+ */
13+ '/((?!api|_next/static|_next/image|favicon.ico).*)' ,
14+ ] ,
615} ;
716
817export function middleware ( request : NextRequest ) {
18+ const url = request . nextUrl . clone ( ) ;
19+ const hostname = request . headers . get ( 'host' ) || '' ;
20+ const isProd = process . env . NODE_ENV !== 'development' ;
21+
22+ if ( isProd && hostname !== 'www.mahata.org' ) {
23+ url . hostname = 'www.mahata.org' ;
24+ url . protocol = 'https' ;
25+ url . port = '' ;
26+ return NextResponse . redirect ( url ) ;
27+ }
28+
929 return NextResponse . next ( ) ;
1030}
You can’t perform that action at this time.
0 commit comments