Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Laravel custom redirect after successful login


Hi,

I am trying to redirect to a custom page after successful login, however it always redirect to dashboard. I made changes AuthenticatedSessionController but again it doesn't redirect to the custom page. I even change the HOME in RouteServiceProvider but it didn't work. How can I change the default page after successful login?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi Tufan Aydın

To customize the page redirection, you'll need to modify the login.blade.php file. Look for the attribute data-kt-redirect-url and change its value to the URL you want to redirect to after login. Here's how you can do it:

Open the login.blade.php file located at /laravel/starterkit/resources/views/pages/auth/login.blade.php.
Find the element that handles the login form. There should be a form element with the kt-login class.

Change the value of data-kt-redirect-url to the URL you want to redirect to after a successful login. For example:

<form class="form w-100" novalidate="novalidate" data-kt-redirect-url="{{ route('dashboard') }}" action="{{ route('login') }}">

Save the file and test your login process. After a successful login, the user should be redirected to the custom page specified in the data-kt-redirect-url attribute.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(