Change /photos paths to rewrites
This commit is contained in:
parent
aacee2f63f
commit
2f513e2b39
@ -8,9 +8,9 @@ export default function middleware(req: NextRequest, res:NextResponse) {
|
||||
if (pathname === '/admin') {
|
||||
return NextResponse.redirect(new URL('/admin/photos', req.url));
|
||||
} else if (/^\/photos\/(.)+$/.test(pathname)) {
|
||||
// Accept full /photos/* paths, but redirect to /p/*
|
||||
// Accept /photos/* paths, but serve /p/*
|
||||
const matches = pathname.match(/^\/photos\/(.+)$/);
|
||||
return NextResponse.redirect(new URL(
|
||||
return NextResponse.rewrite(new URL(
|
||||
`/p/${matches?.[1]}`,
|
||||
req.url,
|
||||
));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user