Home > front end >  How to redirect a domain to a locale in NextJS?
How to redirect a domain to a locale in NextJS?

Time:06-21

My NextJS app has two domains:

  • eldes.com
  • eldes.com.br

I would like that eldes.com.br/:path* to redirects to eldes.com/br/:path*

CodePudding user response:

At @juliomalves's suggestion, I came up with this solution:

{
  source: '/:path*',
  has: [
    {
      type: 'host',
      value: 'eldes.com.br',
    },
  ],
  destination: 'https://eldes.com/br/:path*',
  permanent: false,
},
  • Related