Changing baseURL in Module for Dynamic Request

Maybe I did not explain it well in the topic, but.

Take this Url:


‘pattern’ => ‘backend/useradmin/id/<id:[\d]+>/<cat:[a-zA-Z]+>’,

‘route’ => ‘backend/useradmin/<cat>’,

THis is setup through nested Modules. The problem I am having is that I can use route rules in my base config to forward this request to the proper destination. BUT, the links on those pages reflect is EX. backend/useradmin/custshipping/view, the automatically generated links from GridView drops the "/id/2" and used the route as the url.

In my module useradmin (or anywhere), is there someway I can jump in and change the base path, and gets passed upstream? I have other modules, so it needs to be a global change downstream so all my upstream modules pages links honor the "id/2"

Thanks and cheers

I figured this out (well read deeper), most of the widgets and links are using Url:To(). All I have to do is:

Html::a(’<span class=“glyphicon glyphicon-eye-open”</span>’, [‘update’, ‘userid’=>2, ‘id’=>$model->user_id]);

for the link and add the ‘userid’=>2 parameter and this pattern in my routes will be converted

‘pattern’ => ‘backend/useradmin/id/<id:[\d]+>/<cat:[a-zA-Z]+>’,


For GridView action Items I edited the View page

    <?= GridView::widget([

        'dataProvider' => $dataProvider,

        'filterModel' => $searchModel,

        'columns' => [

            ['class' => 'yii\grid\SerialColumn'],





            // 'token',

            // 'token_expires',

            // 'UserGroup',


	            'class' => 'yii\grid\ActionColumn',

	            'template' => '{view} {update} {delete}',

				//'urlCreator' => function() { return 'shit'; },

	            'buttons' => [

                'update' => function ($url,$model) {

	                    return Html::a('<span class="glyphicon glyphicon-eye-open"</span>', ['update', 'userid'=>2, 'id'=>$model->user_id]);


                'update' => function ($url,$model) {

	                    return Html::a('<span class="glyphicon glyphicon-user"</span>', ['update', 'userid'=>2, 'id'=>$model->user_id]);


                'delete' => function ($url,$model) {

	                    return Html::a('<span class="glyphicon glyphicon-trash"</span>', ['delete', 'userid'=>2, 'id'=>$model->user_id]);





    ]); ?>