Answer the question
In order to leave comments, you need to log in
What is the best way to collect UrlRules from a module?
Good afternoon friends, I started to transfer the project from yii 1 to 2, I have $urlRules = [] in each module, in the first version I scanned all the modules and merged all the rules into one array, in the second one I need to do the same or there is already a ready-made solution in Yii itself??
and the second question is if the url ends with a slash / then it gives 404, where is it set up?
Answer the question
In order to leave comments, you need to log in
I already found a solution for the first question.
use yii\base\BootstrapInterface;
class Module extends \yii\base\Module implements BootstrapInterface{
public function bootstrap($app)
{
$app->getUrlManager()->addRules($this->urlRules, false);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question