I am beginner in next js and i am trying to integrate dynamic folder based routing. For example if we want to create dynamic route we can use [id].js or [slud].js but i want to create routing like, /pages/[name]/index.js i tried many ways suggested on blogs and documentation but unable to resolve this Need help on this part..... I tried to achieve this by finding slug in index file which works but whenever i redirect to another page that slug is gone but i want to fix that slug on routing while accessing the other pages.
i tried this but getting 404 and getting redirected back to homepage with code