NextJS Dynamic redirects
Unanswered
Masai Lion posted this in #help-forum
Masai LionOP
I'm currently working on a project where I'm using PayloadCMS for managing content, including setting up redirects. My goal is to incorporate these redirects into my Next.js application without relying on the next.config.js redirects hook. The reason is that if a user makes changes in the CMS, I'd prefer not to rebuild the entire project just to update the redirects.
I've been exploring the possibility of utilizing middleware to handle these redirects dynamically, but I'm not sure if it's the best approach or how to implement it effectively. Is there a way to cache the redirect routes and revalidate them only when changes occur in the CMS? Or are there alternative strategies that would achieve similar results?
I'd appreciate any insights, suggestions, or examples you can provide on how to efficiently integrate PayloadCMS redirects in Next.js while optimizing for performance and ease of maintenance.
I've been exploring the possibility of utilizing middleware to handle these redirects dynamically, but I'm not sure if it's the best approach or how to implement it effectively. Is there a way to cache the redirect routes and revalidate them only when changes occur in the CMS? Or are there alternative strategies that would achieve similar results?
I'd appreciate any insights, suggestions, or examples you can provide on how to efficiently integrate PayloadCMS redirects in Next.js while optimizing for performance and ease of maintenance.