Q:

Yii2 Pretty URL params

I have set pretty URL for yii2 advanced
at config/main.php
'urlManager' => [
            'class'=>'yii\web\UrlManager', 
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                '/' => 'site/index',
            ],
        ],

.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

some controller
$searchModel = new UserSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);

but query filter from gridView $searchModel still dirty, can I pretty params like some/action?name=jack&shift_id=1 without UserSearch[name]=jack ?
some/action?UserSearch%5Bname%5D=jack&UserSearch%5Bshift_id%5D=1&UserSearch%5Bmanager_id%5D=176

A:

You should override formName() in your search model, to return empty string:
public function formName() {
    return '';
}

