How to setup apache server for React route?

前端 未结 9 1096
无人共我
无人共我 2020-12-08 10:04

I have my react app running great on my local dev server but it did not work when I dump my production ready files straight into Apache\'s htdocs directory:

Here is

9条回答
  •  不知归路
    2020-12-08 10:44

    React routing issue fixed on ubantu server

    Solution:

    1. Open the file using the console.

    If you are using SSL nano /etc/apache2/sites-available/000-default-le-ssl.conf

    Add the following lines

    ===================================================================================

    DocumentRoot /var/www/project RewriteEngine on RewriteCond %{HTTP_ACCEPT} text/html RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.html [last] RewriteRule ^ - [last]

    AllowOverride None
    Options FollowSymLinks Multiviews 
    Require all granted
    

提交回复
热议问题