Php router or something to serve statics react over a php backend

Hi there, first of all sorry about my bad english. Actually I have a client order to create their website low cost, so I trying to deploy a wordpress headless with frontity or other framework like Next or Gatsby. Really I’m asking for a recommendation or some way forward. I need run react front over same domain/hosting than wordpress, in this way I developed a router with Slim framework php that serves statics files generated.

I saw to deploy in vercel, but I don´t know how to manage the DNS domain to get it to work. I asking this questions to clarify how do you do it, I’m a little bit confused.

Thanks a lot!

Hi @Dani

Welcome to the Community!

A Frontity project needs a node.js server to serve the Frontity project and a PHP server for the Wordpress REST API.

Screen Shot 2019-05-09 at 15.40.49

From this infrastructure you can have different setups to manage the domain:

domain www.yourdomain.com (Frontity) and subdomain wp.yourdomain.com (Wordpress)

With this setup your main domain www.yourdomain.com will be directly your Frontity project that can be deployed to vercel or any other hosting

WordPress will be installed under the wp.yourdomain.com subdomain

Your Frontity project (www.yourdomain.com) will do requests to youtr WordPress REST API (wp.yourdomain.com) to get the data

This is one of the simplest setup as once Frontity & Wordpress are both deployed in its proper domain & dubdomains, all you need to do is configuring the URL of your WordPress in your Frontity project

domain www.yourdomain.com (Wordpress)

If you want to maintain your domain stick to your WordPress installation, then you’ll need to configure redirections from your Wordpress server to derive the frontend urls to your Frontity server (that can be deployed to any type of url: my-project.vercel.com for example)

To define these redirections from your WordPress server you can:

  • Use a WordPress plugin
  • Use a custom Nginx configuration
  • Customize any other solution that is having the control of your URL’s

Hope this helps