-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathmiddleware.ts
More file actions
28 lines (23 loc) · 767 Bytes
/
middleware.ts
File metadata and controls
28 lines (23 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import createMiddleware from "next-intl/middleware";
import { defaultLocale, localePrefix, locales } from "@/config/site";
export default createMiddleware({
// A list of all locales that are supported
locales: locales,
localePrefix: localePrefix,
// pathnames: pathnames,
// Used when no locale matches
defaultLocale: defaultLocale,
});
export const config = {
matcher: [
// Enable a redirect to a matching locale at the root
// "/",
// Set a cookie to remember the previous locale for
// all requests that have a locale prefix
// '/(de|en)/:path*',
// Enable redirects that add missing locales
// (e.g. `/pathnames` -> `/en/pathnames`)
// "/((?!_next|_vercel|.*\\..*).*)",
"/((?!api|_next|.*\\..*).*)",
],
};