React 应用程序仅在服务器上显示主页

React app only show home page on the server

我使用 create-react-app 创建了一个 React 应用程序,完成开发后我运行了“yarn build”然后我使用 fileZilla 将文件上传到服务器上的构建文件夹中(我在托管商上有一个高级帐户) 在我的 package.json 中,我添加了以下行:

"homepage": "https://goinprod.com/",

我位于 public_html 文件夹中的 .htaccess 文件如下所示:

# DO NOT REMOVE THIS LINE AND THE LINES BELLOW SSL_REDIRECT:goinprod.com
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} (www\.)?goinprod.com
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# DO NOT REMOVE THIS LINE AND THE LINES BELLOW SSL_REDIRECT:goinprod.com

# DO NOT REMOVE THIS LINE AND THE LINES BELLOW UPGRADE_INSECURE_REQUESTS:goinprod.com
Header always set Content-Security-Policy: upgrade-insecure-requests
# DO NOT REMOVE THIS LINE AND THE LINES BELLOW UPGRADE_INSECURE_REQUESTS:goinprod.com


# DO NOT REMOVE THIS LINE AND THE LINES BELLOW SSL_REDIRECT:goinprod.com
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} (www\.)?goinprod.com
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# DO NOT REMOVE THIS LINE AND THE LINES BELLOW SSL_REDIRECT:goinprod.com

主页看起来不错,但是当我在另一个页面中导航时,它显示以下错误

服务器上的文件结构:

static ( folder )
asset-manifest.json
favicon.ico
index.html
logo.png
logo2.png
manifest.json
.htaccess.
precache-manifest.json
robots.txt
service-worker.js

我的网站 link : https://goinprod.com/

这是一个路由问题,我刚刚在 public_html 文件夹的 .htaccess 文件中添加了以下代码:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>