Redirect back to original destination after login in Laravel

In this post i want to show you some basic tips for redirecting user back to original destination path or some defined path with simple steps.

If you want to send user to previous original destination URL after login.Laravel stores and updates the each entry page in the Session,so as soon as a login is successful, you can do

just in case the intended is not available at the moment, we can set redirect URL.

And you can change the original intended by setting a new one using Session

Once you have authenticated the user using Auth::check() you’ll be able to grab the authenticated user with Auth::user(). so based on Auth::user() data you can redirect user to user specific page.

Here is the simple way of redirecting.

That’s it. Thanks you! Happy coding…..

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 vote
Article Rating
Notify of
Newest Most Voted
Inline Feedbacks
View all comments
5 years ago

Where do you write “return Redirect::intended();”? in the AuthController? I have protected $redirectTo = ‘/’; Do i need to delete this line first? Thanks a lot

Le Guennec Maxim
Le Guennec Maxim
4 years ago

same question Protection Status
Would love your thoughts, please comment.x