Can this be doable to serve WordPress and ReactJS in the same server.
I have a ReactJS App that is running in http://127.0.0.1:3000/ and a WordPress' root directory is located at "D:/var/www/html/website".
The ReactJS App will going to use http://loc.website.com/ as well as the WordPress. To prevent WordPress from conflicting the http://loc.website.com/, it has only limited URL path (/wp-admin, /sm-admin, /graphql, /wp-login.php) as a valid url to undergo D:/var/www/html/website/index.php.
This is my current virtual host config
<VirtualHost *:80>
DocumentRoot "D:/var/www/html/website"
ServerName loc.website.com
ErrorLog "logs/loc.website.com-error.log"
CustomLog "logs/loc.website.com-access.log" common
<Directory "D:/var/www/html/website">
Require local
Require ip 127.0.0.1
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS"
Header always set Access-Control-Expose-Headers "Content-Security-Policy, Location"
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
</Directory>
ProxyPreserveHost On
ProxyPassMatch ^/(_next/webpack-hmr)$ ws://127.0.0.1:3000/$1
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
<LocationMatch "^/(wp-admin|sm-admin|graphql|wp-login.php)">
ProxyPass !
</LocationMatch>
</VirtualHost>
Wordpress D:/var/www/html/website/.htaccess contains this config as well
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Is this possible to implement? If not, I have a working separated domains for both app which is working fine.
Thanks for any answers.