我的反应应用程序在 localhost 上运行良好,但是当我将它部署到 gh-pages 或浪涌后,它不会让我使用 URL 在页面之间移动。
用户可以通过点击右上角的 menuItem 进入注册页面。但是如果用户使用http://chat.susi.ai/signup/ URL,它会给出 404 页面
我尝试了几种来自互联网的解决方案,但没有奏效。
下一个问题是:我创建了一个 404 页面,以便在用户尝试移动到损坏的链接时显示出来。它在 localhost 中运行良好。但不在生产中。我尝试了这个解决方案,但没有任何改变。
这是我的 index.js 文件的一部分
const App = () => (
<Router history={hashHistory}>
<MuiThemeProvider>
<Switch>
<Route exact path="/" component={ChatApp} />
<Route exact path="/signup" component={SignUp} />
<Route exact path="/logout" component={Logout} />
<Route exact path="/forgotpwd" component={ForgotPassword} />
<Route exact path="*" component={NotFound} />
</Switch>
</MuiThemeProvider>
</Router>
);
ReactDOM.render(
<App />,
document.getElementById('root')
);
如果有人可以用示例代码为我的问题提出好的解决方案,这对我真的很有帮助。