E
E
EVOSandru62016-03-24 12:30:08
Yii
EVOSandru6, 2016-03-24 12:30:08

Why similar url requests are not accepted in yii1?

Good afternoon, there is such a problem,
2 similar controllers in the client part: ServicesController , PagesController
For some reason, I get into the ServicesController actions without problems, but I don’t get into the PagesController actions (
domen/pages/1
Error 404
Unable to process the "pages/view" request.

domain/pages/update/1
Error 404
Unable to process the request "pages/update"

In theory, the rules for them are the same and are written in config/main.php

'<action:(login|logout|registration)>'                      =>  'users/<action>',
        '<action:(contact)>'                                        =>  'site/<action>',
        '<controller:\w+>/<id:\d+>'                                 =>  '<controller>/view',
        '<controller:\w+>/<action:\w+>/<id:\d+>'                    =>  '<controller>/<action>',
        '<controller:\w+>/<action:\w+>'                             =>  '<controller>/<action>',
        /** Менеджер */
        '<module:smanager>'                                          =>   '<module>/services/index',
        '<module:smanager>/<controller:\w+>/<id:\d+>'                =>   '<module>/<controller>/view',
        '<module:smanager>/<controller:\w+>'                         =>   '<module>/<controller>/index',
        '<module:smanager>/<controller:\w+>/<action:\w+>/<id:\d+>'   =>   '<module>/<controller>/<action>',
        '<module:smanager>/<controller:\w+>/<action:\w+>'            =>   '<module>/<controller>/<action>',

Controllers themselves have a standard set of actions. Tried changing the file and class name of PagesController to XyzController and accessing:
domain/xyz
Error 404
Unable to process request 'xyz'.

PagesController :
...
public function actionIndex() {
    $model = Pages::model()->findByPk(1);
    $this->render('index', [
      'model'	=>	$model
    ]);
  }
...

Though domain/services fulfills. Why can this be so?

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