I need configure my Yii2 UrlManager rules like this:
- change
http://domain/site/actiontohttp://domain/action - change
http://domain/module/defaulttohttp://domain/module
so far what I have done:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<module:(!site)>' => '<module>/default',
'<action:\w+>' => 'site/<action>',
],
],
when I trying access module it return 404. But when I remove '<action:\w+>' => 'site/<action>', access module again will show as module/default page. So how to solve this?
You can try this code
insted of this
and it will not work then change sequence of rules