'Can I use react to create a subdomain application?

I have a wordpress site which is live example.com. I want to create a simple holiday rental booking system application like Airbnb but not as advanced. I would like to create this using react, my question is can I create a react application on a subdomain e.g booking.example.com and would there be any problems in doing it that way? From what I have read, I would need to create a custom post type and then make axios requests to pull the data from the database and also the same for post requests.

Alternatively could I potentially create the react application and embed it on a single page template? I want people to be able to create an account, post their own rental properties and pay in order to list it.



Solution 1:[1]

Yes, you can install React,npm on your server. If you are using Apache or Cpanel, then you can create .htaccess file on your react app subdomain root directory.

Options +FollowSymLinks -Indexes
IndexIgnore *
DirectoryIndex
<IfModule mod_headers.c>
RequestHeader set X-Forwarded-Proto https
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(.*)$ http://127.0.0.1:PORT/$1 [P]
</IfModule>

Make are you will change the PORT according to your requirements.

Regards

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ansh Bhatia