Hi everyone
I’ve seen alot of discussions about 404 errors here. So here is another one!
I guess there is a very simple answer to my question but I really need to get moving forward now in my main project.
I have trouble in my main project(advanced template) with 404 on my Debian LAMP installation, it looks like yii can’t render files other than those under views/site folder, otherwise I get a 404. It will not use another controller besides SiteController. I’ve checked all files group and user ownership. They have the same ownership and permissions as views/site folder(works as a sharm under windows though(Wamp setup). So I’ve been crying blood because of this. So I decided to try to reproduce my problem. I created a new advanced template in /var/www and renamed advanced folder to test.
Here’s my network setup with apache2.
in my hosts file it looks like this
/etc/hosts:
127.0.0.1 localhost
127.0.0.1 test
The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
in my apache2 conf file:
ServerAdmin webmaster@localhost
ServerName test
ServerAlias test
DirectoryIndex index.php
DocumentRoot /var/www/test/frontend/web
I’ve reloaded all confs using service apache2 reload and restarted apache2.
Now the standard setup is done and standard pages are up and running.
In my frontend/config/main.php you will see this default option
‘controllerNamespace’ => ‘frontend\controllers’,
under controllerNamespace I have added
‘defaultRoute’=>‘objects/index’,
except defaultRoute everything is standard setup by the template.
I’ve used Gii to create a model called ObjectTypes in frontend/models/ObjectTypes.php
I’ve also used Gii to create views, a controller and Search model.
Below you’ll see a typical default setup with Gii
Views Object:
frontend/views/objects/create.php
frontend/views/objects/_form.php
frontend/views/objects/index.php
frontend/views/objects/_search.php
frontend/views/objects/update.php
frontend/views/objects/view.php
Controller:
frontend/controllers/ObjectTypesController.php
Models:
frontend/models/ObjectTypes.php
frontend/models/ObjectTypesSearch.php
So if I want my application to use ObjectTypesController as default, not SiteController. Am I using wrong setup in my main config file? There is another public property in Applications class which is called controller, but this one is read-only and so defaultRoute is the property to use according to Yii Framework 2 guide. Could it be a problem with permissions somewhere else in the advanced template? Or should I add other properties to my config file?
thanks in advance
// Robert