Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sanjay1688's avatar

On redirect my session value are getting destory

I had 2 routes if i uncomment from 1 route i can able to see my session values in 1st route. But if i get redirect to my 2nd route i cant able see my session variables can any one help me out.

Route::get('/check', function(){
Session::put('id', 1); Session::put('id1', 11); //return Session::all(); return Redirect::to('/check1'); });

Route::get('/check1', function(){
return Session::all(); });

0 likes
7 replies
angelvargas's avatar
Route::get('check', function(){
    Session::put('id', 1);
    Session::put('id1', 11);
    return Redirect::to('check1');
});
Route::get('check1', function(){
    return Session::all();
});
sanjay1688's avatar

Hey angelvargas,

It works on my local machine but strange it does not work on my server.

Please or to participate in this conversation.