All New Gii Models/crud Are 404

Surely I’m doing something painfully silly. I’ve been working in yii for a long time but, as we all are, am new to 2.0.

I’ve created my table, generated the model and the crud (controller+crud). I used default namespacing for everything (app/models, app/controllers). I have urlManager set up as follows


'urlManager' => [

            'enablePrettyUrl' => true,

            'showScriptName' => false,

        ],

And that seems to be working fine as I can get to …com/site/login …com/site/logout …com/gii – so, urlmanager is doing it’s job. My table is backend_users - I’ve tried just about everything, but yii will only return 404.

It’s not accessible at backend_users/index or backend-users/index or anything else remotely close (with or without the /index). I’ve tried disabling urlmanager and using the good ol’ index.php?r=backend_users/index and still nothing.

Furthermore, I’ve configured this model/controller as the backend identityClass and it works great. I just want to be able to manage the users!

Also - thinking I had some confusion about the backend_users vs backend-users, I created a new one just called ‘administrators’ (no room for camels, dashes, or underscores) and still had all 404s.

Some other important tid-bits:

yii2 advanced template

apache 2.4

php 5.5

What am I spacing on?

Thanks!

Where is this backend_users or administrators controller created - on FRONTEND or BACKEND (since you mentioned you are using yii2 advanced app)?

The default web access paths for frontend and backend (using prettyUrl urlmanager config) are:

  • localhost/frontend/web/controller/action

  • localhost/backend/web/controller/action

It’s all in backend - I have my document root set to .../backend/web/

Also, site/index site/* (anything under siteController) and gii work fine. It’s just the stuff I’m making new.

You may want to check the namespaces under which you have generated your controllers… check the generated CRUD Controller php file to see if the namespace on top is something like




namespace backend\controllers;



Do the same check for your models generated via Gii. It should be




namespace backend\models;



It happened to me and the error is as you said it is in the namespace

CRUD is creating

namespace backend\Controllers;

it should be

namespace backend\controllers;