我有一大堆我需要重定向到新路線的舊路線。Zend Framework:如何將舊路由重定向到新的自定義路由?
我已經定義我的自定義路線的引導:
protected function _initRoutes()
{
$router = Zend_Controller_Front::getInstance()->getRouter();
$oldRoute = 'old/route.html';
$newRoute = 'new/route/*';
//how do I add a 301 redirect to the new route?
$router->addRoute('new_route',
new Zend_Controller_Router_Route($newRoute,
array('controller' =>'fancy', 'action' => 'route')
));
}
如何添加重定向使用301重定向到新航線的老航路?
爲什麼發送301沒有做重定向是什麼時候?從我所看到的只是將舊路線映射到新路線而不重定向? – Fge 2010-11-19 20:49:59
對不起,不好的例子。我正在嘗試重定向,而不是路由。 – Andrew 2010-11-19 20:51:54
我已更新示例以更清晰 – Andrew 2010-11-19 20:54:13