Bad request (#400) tutorial

hello good night i need your help i am learning yii and watching a tutorial i tried to do this and it doesnt work someone help me

public function actionSaluda($mensaje){
return $this->render(“saluda”, [“mensaje” => $mensaje);

public function actionMensaje(){
$this->redirect([“saluda”, “mensaje” => $mensaje]);



Use code tags.Also put the real code you are using. Your code cannot even run let alone get 400 response

Aver eso es un ejemplo de los metodos que intento hacer que funcionen. La cuestión es que el redirect no me funciona es que hay q configurar algo mas en yii o algo?

Tienes que poner un ejemplo real para que uno se dé cuenta. Además, no muchos, incluido yo, saben español. Es el traductor de Google el que acaba de rescatar la situación :slight_smile:

To be very general, check parameters defined in the action you are redirecting to’

class TestsController
    public function actionProfile($user){
        //some stuff here

    //Let us redirect wrong way
    public function actionWrongRedirect(){
        $someId = ....//get the id
        return $this->redirect(['profile', 'id' => $someId]); //BAD request, user is missing

    //Let us redirect correct way
    public function actionCorrectRedirect(){
        $someId = ....//get the id
        return $this->redirect(['profile', 'user' => $someId]);

that’s the way I have it and in the hello view I just do an echo to $ message

This should work. Can you copy and paste (not screenshot) the whole Stack trace?

The 400 (Bad Request) status code indicates that the server cannot or will not process the request because the received syntax is invalid, nonsensical, or exceeds some limitation on what the server is willing to process. It means that the request itself has somehow incorrect or corrupted and the server couldn’t understand it. The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method . Therefore, it prevents the website from being properly displayed. The main thing to understand is that the 400 Bad Request error is a client-side error.

The cause of a 400 error can be a wrongly written URL or a URL that contains unrecognizable characters. Another cause of the error might be an invalid or expired cookie. Also, if you try to upload a file that’s too large. If the server is programmed with a file size limit, then you might encounter a 400 error.