Question

How do I deploy React App along with headless WordPress CMS.

Posted April 23, 2020 679 views
UbuntuWordPressReact

I have a React App that was created using the created-react-app boilerplate. The react app is fetching data from a WordPress API. Now I intend to deploy both the front-end and the back-end on my DO droplet that is already hosting multiple domains. How do I achieve this?

Here is what i already tried:

1) I put the front-end files inside /var/www/abc.com
2) I created a directory named api ** inside **/var/www/abc.com and put all the wordpress files inside that directory.
3) I had a .htaccess file inside /var/www/abc.com so that all requests are routed through index.html
4) My WordPress is configured. But when I access *http://abc.com/api/wp-json/wp/v2/posts * it redirects to a 404 page.

Please help solving the issue.
Thanks in advance.

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!