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 to

      '<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…

"" - wrong contoller name

"" - right contoller wrong action

" 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:


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

    '' => 'module1/site/index',

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

    '' => '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 or