refreshing pages gives 404 error for create-react-app websites using react-router-dom

前端 未结 1 1702
情话喂你
情话喂你 2021-01-15 00:13

So I\'ve read similar questions but answers were too complex for my understanding. I have not set up a back-end, I just use create-react-app and install react-router-dom, an

1条回答
  •  滥情空心
    2021-01-15 00:56

    So turned out to deploy on a c-panel you need to add a .htaccess in the public folder with this:

    Options -MultiViews
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.html [QSA,L]
    

    Now for refreshing or history, it will refer to index.html

    0 讨论(0)
提交回复
热议问题