2
votes

I have a problem with my YII urlManager. urlManager Rules are not applying when urlFormat is 'get'. Here my urlManager code

'urlManager' => array(
   'urlFormat' => 'get',
   'showScriptName' => true,
   //'appendParams'=>false,
   'hostInfo'=>'My Base Url',
   'secureHostInfo'=>'My Secured Base Url',
   'ssl'=>false,
   'class'=>'myUrlManager',
   'rules' => array(
       array(
           'class' => 'application.components.MyBaseUrlManager',
           'connectionID' => 'db',
       ),
       '<controller:\w+>/<action:\w+>/*'=>'<controller>/<action>',
    ),
),

Here myUrlManager is extend class from CUrlManager and MyBaseUrlManager is extended class from CBaseUrlRule.

Is it possible to access the rules of urlManager when the urlformat is 'get'?

Thanks in Advance

1
when the urlFormat is "path" everything is fine? Yeaf for me the access rules can be used with get format. Could you show us the code inside MyBaseUrlManager ? - darkheir
Yes for path everything is fine. But when the urlFormat changed to get MyBaseUrlManager not applying - Srinivasa Reddy

1 Answers

0
votes

You can access rules but these aren't processed or applied. See https://github.com/yiisoft/yii/blob/master/framework/web/CUrlManager.php#L214:

protected function processRules()
{
    if(empty($this->rules) || $this->getUrlFormat()===self::GET_FORMAT)
        return;
    ...