简体   繁体   English

301使用Cakephp重定向

[英]301 Redirects with Cakephp

I am trying to 301 redirect a url to a new place since the original pages don't exist anymore. 我正在尝试301将网址重定向到新位置,因为原始页面已不存在。 The URL I am trying to run is Guns/Rifles/Heckler_Koch/MP5_A4. 我尝试运行的URL是Guns / Rifles / Heckler_Koch / MP5_A4。 I need this to redirect to Guns/Heckler_Koch/. 我需要将此重定向到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')
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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