import { defineMiddleware } from 'astro:middleware'; export const onRequest = defineMiddleware(async (context, next) => { // Only redirect if we're at the root path if (context.url.pathname === '/') { // Use 302 to avoid permanent redirect caching during content negotiation return context.redirect('/en', 302); } return next(); });