how can i add wordpress as subdomain in next js app

679 Views Asked by At

I am developing a Nextjs (react) app who's backend is in wordpress. I've made my app live on vercel platform and connected it with my godaddy's domain. The wordpress is in /admin directory in my public directory. but when I access it with example.com/admin, it redirects to 404 page due to next routing. I tried to add sub-domain for admin but it doesn't seem to work. Is there any solution for this?

1

There are 1 best solutions below

0
On BEST ANSWER

Are you trying to use WordPress as a headless CMS? The most common practice is to expose your API on a https://api.yourdomian.com.

You can make requests to your API service and use a rendering strategy that you prefer ( client-side, static generation, or server-side) depending on your use case.

In terms of where you host the API server, depends on your budget and technical skillset, you can opt-in for managed hosting solutions (Heroku) or roll your own solution using AWS.

Unfortunately, you cannot deploy WordPress on the Vercel platform.