latin and non latin multi language url with next.js

633 Views Asked by At

We have to build react web with next.js and problem with multilanguage url. Our goal is same content for diffrent language have diffrend url slug. For example www.tld.com/blog for blog page in english post list, www.tld.com/блог for blog page in mongolian blog post.

1

There are 1 best solutions below

0
On

You can use next.js rewrites to transform a subpath like /blog vs /блог to url parameters such as ?lang=en for example, or a different page possible.

Also - just figured this out - if you want static pages with non-latin characters, you can use the url escaped notation in file names and redirects, so a file named %D7%A9%D7%9C%D7%95%D7%9D.js would route to a /שלום url

Hope this helps!