更新操作后,Yii2不会重定向到索引页面

My Update buttons code:

<div class="form-group">
    <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>

and in updateAction I have:

if ($model->load(Yii::$app->request->post()) && $model->save()) {
    return $this->redirect(['index']);
} else {
    return $this->render('update']);
}

but when I update my form and press Update button it updates values BUT it return me the UPDATE page, doesn't redirect to index. What is the problem?

Either

this - $model->load(Yii::$app->request->post()) is false, or this - $model->save() is false.

Check if your initializing the model with class you need (and not another one) and check $model->errors contents, maybe you have some fields that are not on the form and not visible but containing errors.