DEV Community

loading...

Discussion on: Making a multilingual site with Next.js - Part 2

Collapse
elvessousa profile image
Elves Sousa Author

Hello, Chuong!
I have not worked with rewrites yet, but from what I could understand reading the docs on the subject, you don't need to repeat the parameters in the destination property. So, using the image you posted as a basis, try doing this on your next.config.js:

...
async rewrites() {
    return [
        {
            source: '/:type/:name',
            destination: '/profile/:language'
        },
        {
            source: '/:language/:type/:name',
            destination: '/profile'
        },
        {
            source: '/:language/:type/:name/:clinicId',
            destination: '/profile'
        },
        ...
    ]
},
...
...
Enter fullscreen mode Exit fullscreen mode

See if it works!