React-JS sub app

I have a CakePHP project for a football team. In addition to the public site and the admin section, I have a mini-app for the coach to register attendances for training sessions. All three of those are separated with prefixes in the routes.php file and use the standard MVC architecture. The attendance app uses jQuery mobile which is really outdated, so I have now upgraded it to use React-JS. Therein lies the problem.

I am now using CakePHP only to serve as an API for the attendance app, but the public and admin section is still regular MVC CakePHP. How can I refactor the .htaccess files (both root and webroot) to accept the /attendance URL to bypass CakePHP and instead render the React app found at webroot/attendance. All other URLs should still be routed through to webroot/index.php

I could probably just render the react app as a layout template, but that seems improper and won’t separate the react app from the cake app code-wise.

I have tried differing .htaccess contents, but whenever I type in /attendance, the browser is redirected to webroot/attendance (displayed in the browser url)

Seems I solved it by just copying the .htaccess file from /webroot/ into /webroot/attendance/

Hooray :slight_smile:

Edit: I’m gonna keep the topic up in case someone else has the same issue.

1 Like