Answer the question
In order to leave comments, you need to log in
Did redirect() stop working in Yii2 after site migration?
Moved the site from work to home via git. Made the base connected. Error 400 when creating posts
Found out that tokens should be banned. Forbidden through beforeAction in the controller. The error is gone.
But now after creating the form, there is another problem. The redirect does not work and the user is not redirected anywhere, but remains on the same empty page
return $this->redirect(['view', 'id' => $model->id]);
Answer the question
In order to leave comments, you need to log in
Try this option
return Yii::$app->response->redirect(['view', 'id' => $model->id]);
При чем тут токены? Если они работали на другом сервере - и тут должны.
Очистите кеш (в папке runtime и проверьте что бы скрипт мог туда писать), очистите папку assets, проверьте конфиг.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question