我想配置网址管理器。我需要路线匹配/ deti / festival。或/ deti / festival / Yii启用Deti控制器和节日动作,但现在对于此请求yii返回404,有什么问题?如果我使用选项'suffix'=>'/'rule / deti / festival / work,但其他规则不起作用。 我应该做什么 ?
'urlManager'=>[
'class' => 'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules'=>[
'messages' => 'lk/default/messages',
'students' => 'lk/student/index',
'ulogin/ulogin' => '/reg/ulogin/ulogin',
'ulogin/auth' => '/reg/ulogin/auth',
'lk/anketa/auth' => '/lk/auth/auth',
'lk/anketa/logout' => '/lk/auth/logout',
'deti' => '/deti/deti',
'festival'=>'/deti/deti/view?id=562',
'/deti/festival'=>'/deti/deti/festival',
'/deti/eco'=>'/deti/deti/eco',
'/deti/festival[.\/]?'=>'/deti/deti/festival',
'/deti/eco/'=>'/deti/deti/eco',
'/profile/exhview.php'=>'/exhibitions/default/old',
'/profile/user.php'=>'/profile/profile/old'
]
]
答案 0 :(得分:1)
对于后缀,您可以编写如下的URL规则。
'rules' => [
// ...other url rules...
[
'pattern' => 'deti/festival',
'route' => 'deti/deti/festival',
'suffix' => '/',
],
]