Migrating Vercel Project To Another On A Different Domain
It’s very easy to add a custom domain to a Vercel project. It’s also easy to redirect the default Vercel project URL to another domain or set up separate domains for staging and production. But I had to do some digging to be able to migrate my project from domain
foo to point to a new project on domain
Back in January I created a simple dashboard for following my exercises and put it on
health.unessa.net. The project has kept growing and growing, and eventually I decided to convert it to a full-blown blog. The blog needed a proper name and I wanted to change the domain to match it as well. I put the new project in a new repository and published it at tuonela.unessa.net. Now I had a problem; how do I redirect the (almost zero) traffic from the old project to the new without breaking the old URLs?
Prerequisites: two different Vercel projects w/ custom domains configured.
- Remove the old custom domain from the original Vercel project.
- Add the old custom domain to the new Vercel project.
- Configure a 301 redirect from the old domain to the new domain in the new Vercel project.
This is a proper 301 redirect setup which respects your URLs as well. (So all your old URLs from the old domain are redirected to the same path on the new domain.)