简体   繁体   中英

301 Redirects with Cakephp

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')        

);
Router::connect(
    '/Guns/:manufacturer', 
    array('controller' => 'manufacturers', 'action' => 'items'), 
    array('persist' => array('manufacturer'), 'routeClass' => 'GunRoute')
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM