I'm currently working with a Nextjs site built with Prismic, hosted with Netlify. My client would like to be able to add 301 redirects from within Prismic, and I wondered if anyone had experience setting something like this up?
I currently have my redirects set up in my netlify.toml file, and as far as I am aware this is the only way to set them up with Nextjs hosted on Netlify.
So perhaps some sort of pre-build script that updates the netlify.toml file could work? It would be great to hear from anyone who's done this before, or who has a better idea for how to implement.
Hello @david.al.fox, since this isn't directly related to your Prismic repository, I'd recommend you read Netlify's official docs: Next.js redirects and rewrites on Netlify | Netlify Docs
To clarify, I am already aware of how to set up redirects via Netlify's _redirects and netlify.toml. As mentioned in the OP, this is how the redirects are set up at the moment.
What my client is now asking for, is to be able to set up these redirects in Prismic, so I'm looking for a way to be able to use Prismic to set up these 301 redirects.
I see. Thanks for the clarification.
This isn't something that can be set up in your Prismic repository.
Hey @david.al.fox I've done this in the past for clients. I'll put it on my list to create a tutorial on how to do it - I'll share it here whenever I have it ready