Next.js Discord

Discord Forum

Do I need to exclude resources in public directory from i18n Middleware URL check item by item?

Unanswered
Satin Angora posted this in #help-forum
Open in Discord
Avatar
Satin AngoraOP
I'm following [i18n example from Next.js](https://github.com/vercel/next.js/blob/canary/examples/app-dir-i18n-routing/middleware.ts) and I noticed that I need to explicitly ignore files in public directory.
I want to ask, do I need to exclude every single item? My static resources are located in path public/res/<resource category>. Can't I just ignore the /public/res folder?

How should I modify the matcher regex?
export const config = {
  matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)']
}

0 Replies