我不确定我做错了什么,但我正在尝试使用routes.php将旧网址重定向到新网址
old url = www.mywebsite.com/old_url
new url = www.mywebsite.com/sub_folder/old_url
这是我独立尝试的所有尝试,但都失败了:
Router::connect('/old_url', array('controller' => 'my_controller', 'action' => 'old_url'), array('pass' => array('/sub_folder/old_url')));
Router::connect('/old_url', array('controller' => 'my_controller', 'action' => 'old_url'));
Router::redirect('/old_url', array('controller' => 'my_controller', 'action' => 'old_url'));
Router::redirect('/old_url', array('controller' => 'my_controller', 'action' => 'old_url'), array( 'pass' => '/sub_folder/old_url'));
Router::redirect('/old_url', array('controller' => 'my_controller', 'action' => 'old_url'), array( 'persist' => '/sub_folder/old_url'));
我仔细阅读了这本书。这可能吗?任何指导都表示赞赏。
答案 0 :(得分:0)
Router :: connect('/ old_url / *',array('controller'=>'my_controller','action'=>'old_url'));