-2

I have some problem - urlrules is correct but generated url from yii\bootstrap\Nav not correctly ->: {domain}/armory/search?server=Lorem+ipsum but this url working too -> {domain}/armory/search/Lorem+ipsum

'search/<server>' => 'search/index'

url rule ^

protected function addUrlManagerRules($app)
{
    $app->urlManager->addRules([new GroupUrlRule([
        'prefix' => $this->id,
        'rules' => require __DIR__ . '/url-rules.php',
    ])],true);

}

why this not generate url like {domain}/armory/search/Lorem+ipsum

'url' => ['/armory/search', 'server' => 'Lorem+ipsum'],
Qblolz
  • 1
  • 1

1 Answers1

0

You need to use pattern in the format <ParamName:RegExp>

Read here

try something like this in your urlManager section rules.

'site/search/<server:\w+>' => 'site/search'

Url::to(['site/search', 'server' => 'lorem_ipsum']) could be display site/search/lorem_ipsum

V. Buriy
  • 1
  • 1
  • 3