开发者

Help with routing (/:name/:named_param)

开发者 https://www.devze.com 2023-03-19 07:17 出处:网络
Im stuck in cakephp routing. I want to redirect开发者_C百科 \"/coches/mustang-100/\" to \"cars\" model with \"display\" view.

Im stuck in cakephp routing.

I want to redirect开发者_C百科 "/coches/mustang-100/" to "cars" model with "display" view.

I'm trying with this, but it redirects me to "cars" "index" view:

Router::connect('/:coches/:modelo_coche/',
    array('controller' => 'cars', 'action' => 'display'),
    array('pass' => array('modelo_coche'),'coches' => 'coches')
);

I want to: www.myweb.com/coches/mustang-100/


I hope I got your needs right, please try if this one matches what you want:

Router::connect('/coches/:modelo_coche', array('controller' => 'cars', 'action' => 'display'), array('pass' => array('modelo_coche')));


This probably isn't the answer but I don't have the rep to comment on your question yet.

But, can you put a trailing slash on the end of a route like that?

I've never seen routing done with slashes at the end so this could be the problem here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号