skip to Main Content

We currently have a React Web app. We’d like to be able to add WordPress in a subdirectory of the application. So for example:

Currently our app is containerized on AWS.

How would we go about doing this?

2

Answers


  1. Updated: as @Brendan Bond suggest, you would need to setup a web server to serve the wordpress setup. You cannot just put the wordpress folder under a react app to make it work. However if you want to set up wordpress in a subfolder, you can follow the step below.

    I would assume you know how to config the web server which serves wordpress. You would need to work through the following steps.

    1 Take the official wordpress guide as the reference, config wordpress to work under the path:
    https://wordpress.org/support/article/giving-wordpress-its-own-directory/

    2 Config the web server which serves wordpress (e.g. apache2) and make sure https://examplesite.com/blog is pointing to your wordpress installation

    3 Put the link (https://examplesite.com/blog) in your react app and test if you can visit the wordpress site properly.

    Login or Signup to reply.
  2. The easiest way that worked for me:

    1. You need to have PHP server.
    2. Build your react app and upload via FTP to public_html.
    3. Upload wordpress to public_html/blog folder and setup db for it.
    4. Update your .htaccess file for React routing:
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteRule ^index.html$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-l
      RewriteRule . /index.html [L]
    </IfModule>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search