多个项目的nginx设置,包括使用browserhistory反应SPA

目前我有三个项目要在同一个域上运行。</ p>

根目录/ home / theme(html + css + php)</ p>

第一个目录/ home / community(与browserhistory发生反应,所以所有路径都应该重定向到index.html)</ p>

第二个目录/ home / api(node express)</ p>

域名wwww.xyz.com </ p>

所以www.example .com / community / *应该访问社区目录。</ p>

但是browserHistory.replace('/ login')将我重定向到www.example.com/login而不是www.example.com /community/login.


nn

此外,域名www.example.com.anything / else / here / community /应重定向到 http://www.example.com/anything/else/here/community/login 使用react routing,
http://www.example.com/anything/else/here/ 应指向主题 可怕的 ctory和 http://www.example.com/anything/else/here/api < / a>应指向api目录</ p>
</ div>

展开原文

原文

Currently I have three projects which I want to run on same domain.

root directory /home/theme (html + css + php )

1st directory /home/community (React with browserhistory, so all path should redirect to index.html)

2nd directory /home/api (node express)

domain name wwww.xyz.com

so www.example.com/community/* should riderct to community directory.

But browserHistory.replace('/login') redirect me to www.example.com/login instead of www.example.com/community/login.

Also the domain www.example.com.anything/else/here/community/ should redirect to http://www.example.com/anything/else/here/community/login using react routing, http://www.example.com/anything/else/here/ should point to theme directory and http://www.example.com/anything/else/here/api should point to api directory

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问