I have an app created with create-react-app that I want to deploy in my apache server.
When I tried to access my react app running on my server, i had an error 404 on every routes created with react-router. Then i added a .htaccess file in my app directory with the following rules :
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]
Now i'm able to reach the simple routes, like http://mywebsite/myroute.
But when I try to reach nested routes like http://mywebsite/myroute/subroute
I've got a blank page with the following errors :
Uncaught SyntaxError: expected expression, got '<'
and
The stylesheet https://mysite/test/static/css/main.85d72dcf.chunk.css was not loaded because its MIME type, "text / html", is not "text / css"
This happen only when i try to reach a subroute, even if the routes are just html without any css.
I can't find any clue on the web, so any help would be much appreciated.