Problem with SEO url-s

I have these rules defined inside my url manager config:


'rules' => [

    'home/<id:\d+>/<slug>' => 'home/view',

    'home/<id:\d+>/<ter>/<slug>' => 'home/view',

],

<ter> should be additional territory that I wan to use.

When I visit this url manually it works:


localhost/basic/home/15/fr/Some-title

But inside my index view I need to build this url as a part of href in my links, but Url helper outputs me url like :


localhost/basic/home/15/Some-title?ter=fr

I am making url like this :


<a href="<?= Url::toRoute(['home/view', 'id' => $model->id, 'ter' => "fr", 'slug' => $model->title]) ?>">Some link </a>

What I am doing wrong ? Thanks

I have figured it out, I had to change the order of my rules.

from:


'rules' => [

    'home/<id:\d+>/<slug>' => 'home/view',

    'home/<id:\d+>/<ter>/<slug>' => 'home/view',

],

to:


'rules' => [

    'home/<id:\d+>/<ter>/<slug>' => 'home/view',

    'home/<id:\d+>/<slug>' => 'home/view',

],