L
L
Lehahabl2021-05-31 17:10:22
React
Lehahabl, 2021-05-31 17:10:22

How to set up redirects when a city acts as a dynamic route in Next Js?

There is a list of cities of presence ["mks", "spb"]

The project uses a dynamic route [city] - https://nextjs.org/docs/routing/dynamic-routes

- [city]
-- posts
-- news


how to correctly set up redirects from posts, news pages if the city in the url is not valid?
examples
/news -> mks/news
/news/2 -> mks/news/2
/no-page -> /404

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question