You should probably not use this form until you’ve read the full article. If you’ve been here before and know what you’re doing, go right ahead…
One neat way to run WordPress headlessly is by uploading a compiled version of your React.js site to a folder alongside your WordPress install. One of the benefits of this is that you can get around those pesky CORS issues without modifying any rules or fiddling with reverse-proxy shenanigans.
But you still have the problem of WordPress snatching those web requests and trying to serve its own content, or simply 404’ing.
You need to tell browsers where to pull your React.js code from.
Not to worry! We can do it in .htaccess. I’ve even gone ahead and made a sweet generator for you. Just pop the path to the folder containing your static files for react.js in the box up at the top (no slashes – just the folder name). The page will reload and your fresh rules will spit out.
Just copy and paste it into your .htaccess above the existing rules and you’ll be all set.