I have following conditions:
1) expected request is /a1,a2,aN[/.../n1,n2,nN][?range=xxx-yyyy[&search=string]]
(square brackets contain optional parts)
2) action method signature is public function actionIndex(string $alias = '', string $range = '', string $search = ''): string
3) so I used a rule for this:
[
'pattern' => '<alias:[\\w-,\\/]+>',
'route' => 'shop/products/index',
'encodeParams' => false,
],
It works properly until I try to add pagination, LinkPager
ignores a rule I wrote:
[
'pattern' => '<alias:[\\w-,\\/]+>/<page:\d+>',
'route' => 'shop/products/index',
'encodeParams' => false,
],
and displays the alias
and page
params as GET variables.
What is a right rule adding the page number in the end of request URI like
/a1,a2,aN/n1,n2,nN/2
and ignoring if the number is 1?
UPD: I found a reason, this is a rule I defined before:
'/shop' => 'shop/products/index', //it breaks following rules
[
'pattern' => '<alias:[\\w-,\\/]+>/<page:\d+>',
'route' => 'shop/products/index',
'encodeParams' => false,
],
[
'pattern' => '<alias:[\\w-,\\/]+>',
'route' => 'shop/products/index',
'encodeParams' => false,
],
So, how I to make all these rules work together?