here is the actual form

<?php $form=ActiveForm::begin(['action'=>Yii::$app->urlManager->createUrl(['/serial/category/search']),'method'=>'get']); ?> <?= Html::textInput('query','',['placeholder'=>'Поиск']) ?> <div class="form-group"> <?= Html::submitButton('<i class="fa fa-search"></i>') ?> </div> <?php $form=ActiveForm::end(); ?> 

That's how I try to catch it in the rules urlManager.

 '/serial/category/search/<query>' => '/serial/category/search', '/serial/category/search/<query:\w*>' => '/serial/category/search', '<module:serial>/<controller:category>/<action:searh>/<query>' => '<module>/<controller>/<action>', '<module:serial>/<controller:category>/<action:searh>/<query:\w*>' => '<module>/<controller>/<action>', '<module:\w+>/<controller:\w+>/<action:(\w|-)+>/<query>' => '<module>/<controller>/<action>', '<module:\w+>/<controller:\w+>/<action:(\w|-)+>/<query:\w*>' => '<module>/<controller>/<action>', '<module:\w+>/<controller:\w+>/<action:(\w|-)+>' => '<module>/<controller>/<action>', 

it works only the rule the rule accordingly comes such a string

 http://site.com/serial/category/search?query=Запрос 

All these body movements to get such a plan request http://site.com/serial/category/search/Запрос where I do not tell me stupid?

    1 answer 1

    The fact is that the address "where to send" is formed on the client side and he does not know anything about your rules in the url-manager. In fact, it takes what is in the action and adds serialized parameters from the form. To get such an address as you want, then by clicking on a button or by submitting, you need to redirect to the desired page javascript. Sort of:

     window.location = $('.search-form').attr('action') + '/' + $('.search-input').val();