Answer the question
In order to leave comments, you need to log in
UrlManager rule for text ids?
Hey!
Yii2 project. I create a link like this:
<a href="<?= Url::to(['category/view', 'alias' => 'the-test-alias.html'])?>" title="">Some link</a>
As a result, a link of the form is formed:http://mywebsite.com/ru/category/view?alias=the-test-alias.html
http://mywebsite.com/ru/the-test-alias.html
Answer the question
In order to leave comments, you need to log in
'<alias:\w+>' => 'category/view',
UPD: according to your comment, the rule does not work because you incorrectly form the URL
Why is there html? Are you trying to add the html suffix to the link? then you should use the suffix parameter in UrlManager
For example:
'UrlManager' => [
'suffix' => '.html'
]
Url::to(['category/view', 'alias' => 'the-test-alias'])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question