简体   繁体   English

使用子域部署的React应用程序无法正常工作

[英]React application deploying with sub-domain is not working

I am little bit trouble in my react application. 我的应用程序有点麻烦。 I developed two seperate project in react one for front end and another for admin dashboard. 我开发了两个单独的项目,其中一个用于前端,另一个用于管理仪表板。 Now I want to host them like following: 现在,我想像下面这样托管它们:

www.example.com and www.example.com/admin www.example.comwww.example.com/admin

Hence if I upload two different react project in subdomain it gives me 404 error and it should be. 因此,如果我在子域中上传了两个不同的React项目,它会给我404错误,应该是。 I used two separate project for two different design implementation as react can serve one index html only in a project. 我将两个单独的项目用于两个不同的设计实现,因为react仅可在一个项目中提供一个索引html。 I googled a lot about this but can not taking in a final situation . 我对此进行了很多搜索,但无法最终考虑。 If anyone can suggest me in a good way it would be thankful. 如果有人能很好地建议我,那将是感激的。

You have to make some changes on your router. 您必须在路由器上进行一些更改。 I think this blog post would help you 我认为这篇博客文章会为您提供帮助

https://medium.com/@svinkle/how-to-deploy-a-react-app-to-a-subdirectory-f694d46427c1 https://medium.com/@svinkle/how-to-deploy-a-react-app-to-a-subdirectory-f694d46427c1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM