V
V
vyacheslavdmitrievich792020-09-19 17:30:39
Yii
vyacheslavdmitrievich79, 2020-09-19 17:30:39

Why don't other actions besides index work?

Hello!

I go to the main page with the Site controller, actionIndex, everything works, as soon as I go to another page with any other action in the Site controller, a 404 empty page is displayed. The urlManager is written in the config like this:

'urlManager' => [
      'enablePrettyUrl' => true,
      'showScriptName' => false,
      'enableStrictParsing' => true,
      'rules' => require(__DIR__ . '/routes.php'),
    ],


And in the routers.php file:
<?php

return [
    '<action>'=>'site/<action>',
    'company/<action>'=>'company/<action>',
    'moderation/<action>'=>'moderation/<action>',
    'login'=>'site/login',
    'logout'=>'site/logout',
    'moderation/user/emailsort'=>'moderation/user-emailsort',
    'moderation/reviews/deleted'=>'moderation/reviews-deleted',
    'moderation/reviews/approved'=>'moderation/reviews-approved',
    'moderation/queries/approved'=>'moderation/queries-approved',
    '' => 'site/index'
];


If in the config, I change "/" => "site/ index ", to "/" => "site/ login ", then actionLogin is triggered when entering the main page, and if you go to the / login page, then this config is "login" => "site/login", doesn't work.

What could be the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question