我的React App放在网上时出现问题

问题描述 投票:0回答:2

我创建了我的React App,npm run build ...把​​我的文件放在filezilla中,但问题是我有这个错误

Not Found
The requested URL /main was not found on this server.

当我去https://clickswinner.alwaysdata.net以外的页面

你有什么建议的?

javascript reactjs production filezilla
2个回答
0
投票

尝试创建.htaccess文件并将其放在服务器的根目录下

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

1
投票

谷歌是你的朋友

这是一篇关于如何解决Filezilla https://medium.com/@christine_tran/deploying-a-simple-react-application-using-ftp-filezilla-dreamhost-1e5ff6b8abd6 404问题的文章

© www.soinside.com 2019 - 2024. All rights reserved.