Both your route configurations points to that the URL "/article" follows by a parameter, so in your case only the first is used.
Change them as follows: Router::connect('/article/show_by_day', ...rest of your definition ...); Router::connect('/article/slug-post', ...rest of your definition...); Kindly inform us whether or not that solved your problem :) Enjoy, John On Wednesday, 7 January 2015 03:34:43 UTC+2, Lợi Nguyễn Đình wrote: > > I am facing some problems in routing under cakephp > there are two actions in my controller > they are as below: > example.com/posts/show/show-by-day > example.com/posts/view/slug-post > > I want them as: > example.com/article/show-by-day.html > example.com/article/slug-post.html > > > So i routes file under config file I wrote as: > Router::connect('/article/:show_by_day', array('controller' => 'posts', > 'action' => 'show'), array('pass' => array('show_by_day'))); > > Router::connect('/article/:slug', array('controller' => 'posts', 'action' > => 'view'), array('pass' => array('slug'))); > > > its working fine when I hit the url example.com/article/show-by-day.html > > but when I hit url example.com/article/slug-post.html , its again point > to action show. > > So how can I solve it? > Many thanks! > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.