SourceS
SourceS

Reputation: 59

Yii urlManager rules

What do I have to write in config main.php in order to change a couple of urls:
1. From 'page?role=4' to 'new'
2. From 'site/page/85' to 'anothernew'

The following rules do not work inside the urlManager, they return a page with a header but no content:
1. 'new' => 'page?role=4'
2. 'anothernew' => 'site/page/85'

I tried with the full url, too, with no luck:
1. 'new' => 'https://www.sitename.com/page?role=4'
2. 'anothernew' => 'https://www.sitename.com/site/page/85'

This has already been added to config.php:

'urlManager' => array(
        'urlFormat' => 'path',
        'showScriptName' => false,
        'caseSensitive' => false,
        'rules' => array(
            'index' => 'site/index',
            '<controller:\w+>/<id:\d+>' => '<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>' => 
            '<controller>/<action>',
            '<controller:\w+>/<action:\w+>' => '<controller>/<action>', 
),
);

Upvotes: 0

Views: 61

Answers (0)

Related Questions