Hi -
With yii 1.x I was able to assign a different suffix or no suffix at all for each rule.
For example here some of my rules have the .html suffix and some don’t
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'status-<train>-train-on-<date>'=>array('status/view', 'urlSuffix'=>'.html', 'caseSensitive'=>false),
'status-<train>-train'=>array('status/view', 'urlSuffix'=>'.html', 'caseSensitive'=>false),
'subway/view/<train>'=>'status/view',
'subway/view/<train>/date/<date>'=>'status/view',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
[...]
With Yii2 I can only add the suffix to the UrlManager array and therefore apply the suffix to all the rules
'urlManager' => ['enablePrettyUrl' => true,
'showScriptName' => false, 'suffix' => '.html',
'rules' => ['status-<train>-train-on-<date>' => 'status/view',
'status-<train>-train' => 'status/view',
'subway/view/<train>' => 'status/view',
'subway/view/<train>/date/<date>' => 'status/view',
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
],
],
Any idea on how to achieve the same thing in Yii2?
Thanks
- Matt