Laravel, how to redirect as 301 and 302

Whenever you are unsure, you can have a look at Laravel’s API documentation with the source code. The Redirector class defines a $status = 302 as default value.

You can define the status code with the to() method:

Route::get('foo', function(){ 
    return Redirect::to('/bar', 301); 
});

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)