首页 > 解决方案 > 我们如何将 WordPress 添加到 React App 的子目录中?

问题描述

我们目前有一个 React Web 应用程序。我们希望能够在应用程序的子目录中添加 WordPress。例如:

目前,我们的应用程序在 AWS 上进行了容器化。

我们将如何做这件事?

标签: reactjswordpress

解决方案


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.


推荐阅读