开发者

Help with routing (/:name/:named_param)

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜