javascript - react-router刷新时The requested URL was not found on this server.
本文介绍了javascript - react-router刷新时The requested URL was not found on this server.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
路由定义如下
let routes = (
<Route handler={App}>
<Route path="/" component={App}>
<Route path="/search/:id/:page" component={Search} />
</Route>
</Route>
);
其他功能都对,就是刷新还有直接打开http://localhost/search/66/1的时候找不到url。必须先进http://localhost在跳转到/search/66/1。
url怎么没有井号呢?
解决方案
你上面的那个问题还没碰到过
至于没有#
,我想到的是可能与history有关,现在我配置的都是 history={browserHistory}
,如果是hashHistory 的应该才有#
,具体可以看看官方介绍
这是中文文档 但是中文文档后期的维护比较慢,很多新的东西都没有跟新
这篇关于javascript - react-router刷新时The requested URL was not found on this server.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文