1

I have following file structure

enter image description here

As default the url created for accessing the module content is for example http://127.0.0.1/tmc/user/default/viewMessage

and for other controller it comes out to be http://127.0.0.1/tmc/user/booking/index

The problem is I want to write a rule in my urlManager so that both controllers remain accessible AND i do not see default word in url as in first example.

However if i write following rules I am able to eliminate the default word but now other controllers in same module wont work. any help in this regard is appreciated

'<module:\w+>/<action:\w+>/<id:(.*?)>' => '<module>/default/<action>/<id>', '<module:\w+>/<action:\w+>' => '<module>/default/<action>',

My current Url Manager is as follow

'urlManager' => array( 'urlFormat' => 'path', 'showScriptName' => false, 'rules' => array( '/' => 'site/index', 'login' => 'site/login', 'user' => 'user/default/', '<view:[a-zA-Z0-9-]+>/' => 'site/page', ), ),

Afnan Bashir
  • 7,319
  • 20
  • 76
  • 138

1 Answers1

0

Follow this Link for config settings

Refer this Link

//inside protected/modules/admin/AdminModule.php
class AdminModule extends CWebModule
{
  //goes to TaskController instead of DefaultController
  public $defaultController = 'Task';


...

Now your Yii application will routes to the “TaskController” if you request

   index.php?r=admin
    //same as requesting
    index.php?r=admin/task 
Yatin Mistry
  • 1,246
  • 2
  • 13
  • 35