PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 1, 2022

[FIXED] Need To Run Symfony + ReactJS & WordPress Together

 March 01, 2022     lamp, reactjs, symfony, virtualhost, wordpress     No comments   

Issue

For our project we decided for a Symfony app and a WordPress blog. It basically runs an entire installation of WordPress as a subdirectory called /blog inside the /web folder of Symfony.

We setup a quick coming soon page on www.example.com/ (Symfony Route: /) and kept running WordPress blog on www.example.com/blog/

Details about that setup on my question about WordPress as a Symfony subdirectory: WordPress As A Symfony (Symfony3) Subdirectory

Over the course of development we let Symfony power the REST API and developed the application frontend with ReactJS. I am very unsure about the deployment. How will this work?

Note: I can't display WordPress as a React frontend and WordPress REST API because over 200 posts are now designed using a page builder provided by the theme (Lesson learned).

What options do I have?


Solution

You have to create a minified version of the React app and load it from a twig template. If you are using any react router, you will have to deal with the base url of your panel to make the urls be valid.

For instance, if you develop with a local server: localhost:3000/my/fancy/panel

in production can happen that this url becomes

www.yourdomain.com/users/panel/my/fancy/panel

You you have to configure your router and routes to prefix /users/panel in production environment.

In my case I inject that base url in the tpl or twig and the app doesn't need to care about the environment.

Your app needs to display the Wordpress posts?



Answered By - Carlos
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing