Admin Module Url Management




'urlManager' => array(

  'urlFormat' => 'path',

  'showScriptName' => false, //Added to remove index.php

  //'caseSensitive' => true,

  'rules' => array(

      //Admin URL                

      'admin' => 'admin/default/home',

      'admin/default' => 'admin/default/home',

      'admin/<controller:\w+>' => 'admin/<controller>/admin',

      'admin/<controller:\w+>/<action:\w+>' => 'admin/<controller>/<action>',

      //Front URL

      'getbrowser' => 'site/getbrowser',

      '' => 'index/index',

      'index' => 'index/index',

      'services' => 'index/services',

      'design/<id:[\w-]+>' => 'index/design',

      'design' => 'index/design',

      'blog' => 'index/blog',

      'testimonials' => 'index/testimonials',

      'captcha' => 'index/captcha',

      '<id:[\w-]+>' => 'index/pg',

      '<pg:[a-zA-Z0-9-_]+>/<divId:[a-zA-Z0-9-_]+>' => 'index',                

      '<controller:\w+>/<id:\d+>' => '<controller>/view',

      '<controller:\w+>' => '<controller>/index', //added to handle www.mysite.com/index to www.mysite.com

      '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

      '<controller:\w+>/<action:\w+>' => '<controller>/<action>',

),



The issue is that when i try to generate error with such urls, it just takes IndexController for frontend and not default controller of admin module…

"www.mysite.com/admin/asdf" - wrong contoller name

"www.mysite.com/admin/testimonial/asdf" - right contoller wrong action

"www.mysite.com/admin/testimonial/admin asdf" - right contoller right action but some random char at end of url

I want to handle above url so that i can give proper validation message or throw error 404.

Also, any suggestions for URL management is welcome… Thank you.

I have a similar question, except my rules are:




'rules'=>array(

    'http://site1.dev/<controller:\w+>/<action:\w+>' => 'module1/<controller>/<action>',

    'http://site1.dev' => 'module1/site/index',


    'http://site2.dev/<controller:\w+>/<action:\w+>' => 'module2/<controller>/<action>',

    'http://site2.dev' => 'module2/site/index',

),



The error message is being loaded from the top level SiteController, and not the one in the module when I load either site1.dev or site2.dev.