Harpreet Singh
Harpreet Singh

Reputation: 189

Yii generates error "Unable to resolve the request <controller/action>"

After logged in successfully, Yii does not executing any page.

Showing an error:

Error 404 Unable to resolve the request "membersdet/index"

Here membersdet is controller Id and index is an action.

Upvotes: 15

Views: 37610

Answers (7)

Đọc truyện hay
Đọc truyện hay

Reputation: 2023

Check case sensitive exactly your controller: MembersdetController

Check alias (common in config/main.php) map with namespace in your controller

Yii::setAlias('@tienn2t', dirname(dirname(__DIR__)) . '/tienn2t');

In MembersdetController.php file

<?php
namespace tienn2t\controllers;

use Yii;
use yii\web\Controller;

class MembersdetController extends Controller{
    public function actionIndex(){
        echo 1;die;
    }
}

Upvotes: 2

Correcter
Correcter

Reputation: 3686

Check errorHandler block in your config file. I had fix this error like this

'errorHandler' => [
    'errorAction' => 'error/index',
],

By the way you should have appropriate ErrorController in your module and /error/index.php file in view folder. Hope will help you.

Upvotes: 0

user3693845
user3693845

Reputation: 21

I have had a similar problem and got it solved. In this case the file was correctly named but the class name was wrongly spelled. When these two do not correspond, you could get this error too.

Upvotes: 1

radhika
radhika

Reputation: 89

It is because of wrong controller file name given or may be actionIndex() method is not in your controller.

Upvotes: 4

Johnatan
Johnatan

Reputation: 1268

Make sure the filename of your controller is EXACTLY "MembersdetController.php". It is case sensitive.

I guess you were developing on local machine under Windows OS and server runs on *nix system. That's normal issue for novice developers, that they forget about case sensitive file system in *nix.

Upvotes: 21

Boaz Rymland
Boaz Rymland

Reputation: 1467

Make sure you have MembersdetController in /protected/controllers/ and this class "is a" CController and has a public method named actionIndex().

Upvotes: 0

MazarD
MazarD

Reputation: 2740

There is not enough information in the question, but maybe you have an incorrect .htaccess or if you don't have an htaccess at all you should use the url:

http://host/index.php?r=membersdet/index

Upvotes: 0

Related Questions