Hello,
I am trying to host React and Next project on a single domain.
Basically, we have project which was built using React and hosted on vercel (say checkout.mycompany.com). Now we are building V2 of the same project but with NexJs. We want to host these projects on same domain on a v2 sub path (say checkout.mycompany.com/v2).
I went through https://vercel.com/guides/how-can-i-serve-multiple-projects-under-a-single-domain this documentation but I am running into multiple issues. Can someone help me out here? Lets connect and discuss further.
#Hosting multiple projects on single domain
9 messages · Page 1 of 1 (latest)
I do not know how to do it that way but
you can hos it with different subdomain
for ex: checkout2.mycompany.com
I am using Firebase auth.
And there is a dashboard which is hosted on checkout.mycompany.com.
So changing subdomain is not a option I have at the moment
you might clone that auth into the next maybe? because the roots are basically a nextpage in NextJS
Found the solution!
I added vercel.json file in my base project which is hosted on checkout.mycompany.com
In this file, I added a redirect
"source": "/v2/:match*",
"destination": "https://new-project.vercel.app/v2/:match*"
}```
Then in `next.config.js` file of my next project I added `basePath: '/v2'`
Also, since all assets would be inaccessible in `/v2` I had to make changes to all links
e.g: `/assets/loader.svg` now becomes `/v2/assets/loader.svg`
Anyways Thanks @calm bane for responding
wow thats perfect , thanks for sharing your solution 🙂