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

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


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 (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:

1. Open the `/routes/web.php` file in your Laravel project.

2. Find the route definition for the root (`/`) URL.

3. Ensure that the route pointing to the homepage (landing page) is outside of the `auth` middleware group. By default, Laravel redirects unauthenticated users to the login page when they try to access routes within the `auth` middleware group.

4. Move the route definition for the homepage outside of any middleware groups, like this:


// Route for landing page (outside of auth middleware)
Route::get("/", [LandingPageController::class, "index"]);

// Routes within the auth middleware group
Route::middleware(["auth"])->group(function () {
// Your authenticated routes here
Route::get("/dashboard", [DashboardController::class, "index"]);
// Other authenticated routes...
});


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.



yeah, thanks


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  :(