0

If I add this configuration of the cms module to the config file

'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
]

It adds the default route of this module to all the routes like this /cms/site/login /cms/site/index /cms/site/error. Why this is happening and how i can remove this?

Muhammad Omer Aslam
  • 22,976
  • 9
  • 42
  • 68
rajwa766
  • 604
  • 13
  • 31
  • @MuhammadOmerAslam – rajwa766 Jan 09 '19 at 13:51
  • I don't get what you are asking here, please add your complete configurations file and also if you are using `advance` or `basic` app. – Muhammad Omer Aslam Jan 09 '19 at 22:28
  • @MuhammadOmerAslam if i open routes in rbac i need there like /site/login /site/signup etc , all the routes need to start with there controller.this is happen when i add the cms module in config file.The routes dosent add cms in the routes like /cms/site/login when i remove the cms module from config. – rajwa766 Jan 10 '19 at 09:56

1 Answers1

1

If you want to remove the /cms module prefix by default, you can add a global route to backend/config/main.php(If you use advanced templates): '<controller:[\w-]+>/<action:[\w-]+>' =>'cms/<controller>/<action>'.

for example:

// backend/config/main.php
return [
    'urlManager' => [
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules' => [
            '<controller:[\w-]+>/<action:[\w-]+>' =>'cms/<controller>/<action>'
        ],
    ],
];

Access in your bowser: www.xxx.com/site/index, it is forwarded to: /cms/site/index

Luna
  • 2,132
  • 2
  • 7
  • 14