Skip to content

Commit

Permalink
Merge pull request #32 from erland-syafiq/middelware
Browse files Browse the repository at this point in the history
Added middleware
  • Loading branch information
erland-syafiq authored Jun 6, 2024
2 parents 11ebc76 + 9cf8614 commit 0a21db6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions site/middleware.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { NextResponse } from "next/server";

export function middleware(request) {

if (/[A-Z]/.test(request.nextUrl.pathName)) {
const url = request.nextUrl.clone();
url.pathname = pathname.toLowerCase();
return NextResponse.redirect(url);
}

return NextResponse.next();
}

0 comments on commit 0a21db6

Please sign in to comment.