React website with React Router not working correctly in subdirectory

Hello, I have a simple web located in a subdirectory and I have only managed to make the root route / work by always specifying index.html at the end.

If I paste a URL like: mywebsite/QRCODE/index.html/qr?url=www.url.com, Infinityfree throws a 404 error. I have tried different htaccess configurations without any improvement. Could someone tell me if this has a solution and what should I do? Thanks.

Our hosting doesn’t support server side JavaScript (aka Node.js). If your application depends on server side React scripts, then I’m afraid that it cannot work.

1 Like

React and React Router are client side and use JavaScript and generate a build with HTML, CSS, and JavaScript. Perhaps it might be possible to solve it with an htaccess configuration? The problem is with redirect

You may try to search for the appropriate .htaccess rule to use then. I’m not a React expert (admittedly), but you should be able to find such rule on Google.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.