Reputation: 198
I am trying to 301 redirect a url to a new place since the original pages don't exist anymore. The URL I am trying to run is Guns/Rifles/Heckler_Koch/MP5_A4. I need this to redirect to Guns/Heckler_Koch/. I have tried so many things, but this is the only thing I could come up with and it doesn't work. When I run this it brings me to, manufacturers/items/. Thank you for your help.
Router::connect(
'/Guns/:manufacturer',
array('controller' => 'manufacturers', 'action' => 'items'),
array('pass' => array('manufacturer'), 'routeClass' => 'GunRoute')
);
Router::redirect(
'/Guns/Rifles/:manufacturer/*',
array('controller' => 'manufacturers', 'action' => 'items'),
array('pass' => array('manufacturer'), 'status' => '301')
);
Upvotes: 1
Views: 929
Reputation: 1625
Router::connect(
'/Guns/:manufacturer',
array('controller' => 'manufacturers', 'action' => 'items'),
array('persist' => array('manufacturer'), 'routeClass' => 'GunRoute')
);
Upvotes: 1