Now My application is using gridview to list all information and it\'s also have pagination.when the user click on pagination number and then click on edit and then save. It red
Here it says that it's a good practice to check if referrer
is set at the first place.
So if you use the following code you will be redirected to last page if referrer is set or to your configured homeUrl
if the return URL was not set previously.
return $this->goBack((!empty(Yii::$app->request->referrer) ? Yii::$app->request->referrer : null));
goBack() details
redirect details