Answer the question
In order to leave comments, you need to log in
How to host a React app with routing?
I have a React application with routing (react-router-dom) and FireBase. And there is so far a test hosting (Apache). I made a build yarn run build
and uploaded it to hosting. The main page opens, and when you enter site.ru/admin
, 404 comes out.
I threw all possible .htaccess options, but to no avail.
Tell me how to implement it correctly so that routing works.
Answer the question
In order to leave comments, you need to log in
Have you tried this .htaccess option? Helped me.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question