REDIRECT TO HOME PAGE
I am using Starterkit Metronic Laravel 10.0 and when I try to visit root (/) it automatically redirect to login page. I want to show a landing page and open login page when user click login button. How can I do this
Replies (2)
Hi,
Apologies for the delay.
To achieve what you want, you'll need to adjust the route configuration in your Laravel application. Here's what you can do:
-
Open the
/routes/web.phpfile in your Laravel project. -
Find the route definition for the root (
/) URL. -
Ensure that the route pointing to the homepage (landing page) is outside of the
authmiddleware group. By default, Laravel redirects unauthenticated users to the login page when they try to access routes within theauthmiddleware group. -
Move the route definition for the homepage outside of any middleware groups, like this:
By moving the route for the landing page outside of the auth middleware group, it won't require authentication to access it. Users will see the landing page when they visit the root URL (/). Then, they can navigate to the login page manually when needed.
Hope this helps! Let me know if you have further questions.