Override Module Urlrules

Hi all!!

I’m wondering how to override url rules from a module.

I have this code in the external module (dektrium/yii2-user/Bootstrap.php) :

 $app->get('urlManager')->rules[] = new GroupUrlRule([

                'prefix' => 'user',

                'rules' => [

                    '<id:\d+>' => 'profile/show',

                    '<action:(login|logout)>' => 'security/<action>', 

                    '<action:(register|resend)>' => 'registration/<action>',

                    'confirm/<id:\d+>/<token:\w+>' => 'registration/confirm',

                    'forgot' => 'recovery/request',

                    'recover/<id:\d+>/<token:\w+>' => 'recovery/reset',

                    'settings/<action:\w+>' => 'settings/<action>'



And i want to override this rules in my config.php because i think is not a good thing to modify module code for this such of thing, and because am working in a multilanguage app with especific managment of urls.

Is there a way to do it, in my global urlManager rules definition?

thanks in advance.

your problem can be settled easily , write another Bootstrap class for it and then config it in the "bootstrap" section using your own class .

anyway overwrite the url rules in module is a good way !

you should read the yii-gii or yii-debug module . :lol:

there you can find the recommend way to doing what you want . :D


i will follow your advice!