Not Found (#404) Page not found.


(Wisnu Widyawan) #1

Hi. I’m a beginner. I have a when to open CRUD or to create table fields at link address

7513

404 not found.jpg

my table is WsbNewsCategory.

i have declared namespace backend\models;

Do you have this problem like this when installing yii 2


(Genydedx) #2

It’s not clear what you mean. Where does your WsbNewsCategory route point to in your url rules from your config? What does your controller look like? Try looking at some of the basic tutorials like https://www.youtube.com/watch?v=H7uON7rcv4g&list=PLBEpR3pmwCayfpaE9Vk-0xDsE5HQRJxuq to get a basic understanding of how Yii works.


(StonePro) #3

Recently encountered similar problems.
Created models and CRUD with GII. Some Models worked fine but some models generated the Not Found (#404) when trying to request the CRUD views. Even with URL manager. I found out that Yii2 doesn’t like model names with multiple capitals in their name. e.g. I had a model called PProfs and the CRUD views were not found. When I changed the name to Pprofs and regenerated the CRUD view they could be found!
Couldn’t find it anywhere in Forum. So here it is!


(Softark) #4

The name of the model has nothing to do with the urls of the CRUD. It’s the name of the controller that matters in url management.

@StonePro What controller name did you have when CRUD for PProfs model didn’t work? Was it “PProfsController”? And what route did you try to access the CRUD with? It would not work with the url like "http://my.host/pprofs/index". You should have used "http://my.host/p-profs/index" instead.

Please check the following section of the Guide for route, controller ID and controller naming conventions.

https://www.yiiframework.com/doc/guide/2.0/en/structure-controllers


(StonePro) #5

Correct it used PProfsController.
So I now understand the problem was in the naming of the controller. Thanks.
(at least people can find the solution when they make they same mistake)