Files
manoon-headless/middleware.ts
Unchained 92b6c830e1
Some checks failed
Build and Deploy / build (push) Has been cancelled
feat: implement locale-aware routing with [locale] dynamic segments
WARNING: This change breaks existing SEO URLs for Serbian locale.

Changes:
- Migrated from separate locale folders (src/app/en/, src/app/de/, etc.)
  to [locale] dynamic segments (src/app/[locale]/)
- Serbian is now at /sr/ instead of / (root)
- English at /en/, German at /de/, French at /fr/
- All components updated to generate locale-aware links
- Root / now redirects to /sr (307 temporary redirect)

SEO Impact:
- Previously indexed Serbian URLs (/, /products, /about, /contact)
  will now return 404 or redirect to /sr/* URLs
- This is a breaking change for SEO - Serbian pages should ideally
  remain at root (/) with only non-default locales getting prefix
- Consider implementing 301 redirects from old URLs to maintain
  search engine rankings

Technical Notes:
- next-intl v4 with [locale] structure requires ALL locales to
  have the prefix (cannot have default locale at root)
- Alternative approach would be separate folder structure per locale
2026-03-23 20:59:33 +02:00

15 lines
278 B
TypeScript

import createMiddleware from "next-intl/middleware";
import { routing } from "./src/i18n/routing";
export default createMiddleware({
...routing,
});
export const config = {
matcher: [
"/",
"/(sr|en|de|fr)/:path*",
"/((?!api|_next|_vercel|.*\\..*).*)",
],
};