首页 > react-router刷新时The requested URL was not found on this server.

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 的应该才有# ,具体可以看看官方介绍
这是中文文档 但是中文文档后期的维护比较慢,很多新的东西都没有跟新


同问,我目前是,在服务端配置跳转回首页
{

    route : '/*',
    method : 'all',
    callback: function *(){
        this.redirect('/');
    }

}

【热门文章】
【热门文章】