J
J
jnas2018-10-20 15:19:53
Yii
jnas, 2018-10-20 15:19:53

YII2 wrong work Url::toRoute(); after switching to custom modules, it adds a prefix from the module name to other links, how to fix it?

Good afternoon, wow!
Regular links:
In the project, to buttons, etc. I hang links using - \yii\helpers\Url::toRoute();
For example, to go to the user's page and, accordingly, the link on the client will look like mysite.ru/users/index With this, everything is fine until the modules arrive) Links for modules: To go to the page of the module, I use similarities -\yii\helpers\Url::toRoute('users/index')

\yii\helpers\Url::toRoute('module-custom/example/panel')
, on the client side it will look like mysite.ru/module-custom/example/panel users/index already looks like mysite.ru/module-custom/users/index Please tell me how to be in this situation, how to solve the problem without crutches, that is, so that it works fine.


\yii\helpers\Url::toRoute('users/index')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-10-20
@jnas

show url manager, what you describe is very strange. As an option, I can assume that there is not enough slash at the beginning
instead of yours
\yii\helpers\Url::toRoute('users/index')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question