当用户单击服务器上的刷新,或尝试在不存在的应用程序中输入url路径时,我希望将它们定向到登录页面。我想添加这个默认路由会解决它:
<Route path='*' component={LoginPage}/>
虽然它适用于开发服务器,但它在使用Apache的生产中不起作用。我错了什么?
这是我的整个路线页面:
export default (
<Route path={VC.BASEPATH}>
<IndexRoute component={LoginPage}/>
<Route path={VC.BASEPATH} component={App}>
<Route path={VC.BASEPATH + "home"} component={HomePage}/>
<Route component={Builder}>
<Route path={VC.BASEPATH + "builder/admin"} component={AdminPage}/>
<Route path={VC.BASEPATH + "builder/survey_builder"} component={SurveyBuilderPage}/>
<Route path={VC.BASEPATH + "builder/survey_details"} component={SurveyDetailsPage}/>
</Route>
<Route component={Search}>
<Route path={VC.BASEPATH + "search/draft"} component={SurveyQueryContainerPage}/>
<Route path={VC.BASEPATH + "search/prod"} component={ProdSurveyPage}/>
</Route>
</Route>
<Route path={VC.BASEPATH + "preview"} component={PreviewPage}/>
<Route path='*' component={LoginPage}/>
</Route>
);