How to handle URLs with dots in Next.js 14 App folder?

27 views Asked by At

I need a URL structure for my detail page at work. Everything works fine, but if the URL contains any dots, it returns a 404 page. For example:

mysite.com/product/xxxxx-yyyyyy-zzzzz-3.5kg-id

Due to the dot in the URL (specifically, ‘3.5kg’), it results in a 404 error. I’ve tried using the [[…slug]] option and structures, rewrites in Next config but they didn’t work.

1

There are 1 answers

1
sellimenes On

It was because of i18n configurations. I changed middleware matcher and excluded all dots. It works fine now.