RBAC Routes 将模块的默认路由添加到项目的所有路由中?
RBAC Routes add default route of module to all the routes of project?
如果我将 cms
模块的这个配置添加到配置文件
'cms' => [
'class' => 'yii2mod\cms\Module',
'controllerNamespace' => 'backend\controllers',
'defaultRoute' => '',
'froalaEditorOptions' => [
'clientOptions' => [
'heightMin' => 300,
'theme' => 'dark',
'imageUploadURL' => 'upload-image',
'imageManagerDeleteURL' => 'delete-image',
'imageManagerDeleteMethod' => 'POST',
'imageManagerLoadURL' => 'images'
],
'excludedPlugins' => [
'file',
'emoticons'
]
],
'enableMarkdown' => false
]
像这样把本模块的默认路由添加到所有路由中
/cms/site/login
/cms/site/index
/cms/site/error
。为什么会发生这种情况以及如何删除它?
如果要默认去掉/cms模块前缀,可以添加全局路由到backend/config/main.php
(如果使用高级模板):'<controller:[\w-]+>/<action:[\w-]+>' =>'cms/<controller>/<action>'
.
例如:
// backend/config/main.php
return [
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<controller:[\w-]+>/<action:[\w-]+>' =>'cms/<controller>/<action>'
],
],
];
在您的浏览器中访问:www.xxx.com/site/index
,转发到:/cms/site/index
如果我将 cms
模块的这个配置添加到配置文件
'cms' => [
'class' => 'yii2mod\cms\Module',
'controllerNamespace' => 'backend\controllers',
'defaultRoute' => '',
'froalaEditorOptions' => [
'clientOptions' => [
'heightMin' => 300,
'theme' => 'dark',
'imageUploadURL' => 'upload-image',
'imageManagerDeleteURL' => 'delete-image',
'imageManagerDeleteMethod' => 'POST',
'imageManagerLoadURL' => 'images'
],
'excludedPlugins' => [
'file',
'emoticons'
]
],
'enableMarkdown' => false
]
像这样把本模块的默认路由添加到所有路由中
/cms/site/login
/cms/site/index
/cms/site/error
。为什么会发生这种情况以及如何删除它?
如果要默认去掉/cms模块前缀,可以添加全局路由到backend/config/main.php
(如果使用高级模板):'<controller:[\w-]+>/<action:[\w-]+>' =>'cms/<controller>/<action>'
.
例如:
// backend/config/main.php
return [
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<controller:[\w-]+>/<action:[\w-]+>' =>'cms/<controller>/<action>'
],
],
];
在您的浏览器中访问:www.xxx.com/site/index
,转发到:/cms/site/index