Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Phalcon two single routes

I have a problem. I have two routes:

$router->add('/news/{alias:[a-z\-]+}(/?)', array(
      'module' => 'frontend',
      'controller' => 'news',
      'action' => 'view',
      'news_id' => 1,
      'lang' => 'md',
))->setName('news_view_short_e'); //=> /news/282334-alias-news

AND route => /news/index/:

$router->add('/{lang:[' . $langsDefined . ']{2}+}/{controller:[a-z]{3,50}+}(/?)', array(
     'module' => 'frontend',
     'controller' => 2,
     'action' => 'index',
     'lang' => 1,

When I use these routes. not working. But if I remove route with alias. Route working good. How I can resolve conflict?

edited Dec '17

Obviously this second one overrides the first one, i guess you need to add them in reversed order you are adding them now.

edited Dec '17

What does your $langsDefined variable look like?

{lang:[' . $langsDefined . ']{2}+} this should limit the match to two characters, so news shouldnt be matched

Oh yea that's true.