RosS RosS - 1 year ago 157
PHP Question

Not Found (#404) Page not found.Yii2

Hello I have some issue with redirecting in Yii 2 , I have

['label' => 'Home', 'url' => ['/site/index']],
['label' => 'About', 'url' => ['/site/about']],
['label' => 'Contact', 'url' => ['/site/contact']],
['label' => 'Tractor Models', 'url' => ['#']],
['label' => 'Components', 'url' => ['#']],
['label' => 'Users', 'url' => ['/loginuser/index']],

and I have file that is made in LoginUser folder that have index , generated by Gii ,and the redirecting dont work,I I have problem with trying to "redirect" and other pages that I want . Can someone give me some clue about that problem ?

Answer Source

if you use LoginUser as your directory name then you can change to login-user.

Because Url::to() works separating words by hyphen.

Refer yii\helpers\Url::to()

['label' => 'Users', 'url' => ['/login-user/index']],
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download