使用 iron router 重定向旧 URL
Redirecting old URLs with iron router
我需要在我的流星应用程序中重定向旧的 URL (http://my-domain.com/details/detail-form.html) to a new URL (http://my-domain.com/details-form/)。
如何定义这样的第二条路线?
这是我目前的路线:
Router.route('/details', function () {
this.render('detail-form');
})
这就是我要添加到当前路线的内容:
Router.route('/details/detail-form.html', function () {
this.render('detail-form');
});
但是iron router不让我给"detail-form"分配两条路由。
谢谢
在您的旧路线功能中使用 Router.go('<your-new-url>')
。
我需要在我的流星应用程序中重定向旧的 URL (http://my-domain.com/details/detail-form.html) to a new URL (http://my-domain.com/details-form/)。
如何定义这样的第二条路线? 这是我目前的路线:
Router.route('/details', function () {
this.render('detail-form');
})
这就是我要添加到当前路线的内容:
Router.route('/details/detail-form.html', function () {
this.render('detail-form');
});
但是iron router不让我给"detail-form"分配两条路由。
谢谢
在您的旧路线功能中使用 Router.go('<your-new-url>')
。