import { NextRequest , NextResponse } from 'next/server' ; export function middleware ( req ) { if ( req . url === "/" ) { const isInBeta = JSON . parse ( req . cookies [ 'beta' ] || 'false' ) ; return NextResponse . rewrite ( `/${ isInBeta ? 'beta' : 'non-beta' }` ) ; } }