简体   繁体   English

更改 laravel 网站的默认登录页面

[英]Change default landing page of a laravel website

I know i is a very common question, but i am purely new to laravel and i know very little about laravel thats's why i am asking it.我知道我是一个非常常见的问题,但我对 laravel 完全陌生,我对 laravel 知之甚少,这就是我问它的原因。

So point is that when a user enters http://dytube.cric4fun.com/ he must be automatically redirected to the http://dytube.cric4fun.com/login所以重点是当用户输入http://dytube.cric4fun.com/时,他必须自动重定向到http://dytube.cric4fun.com/login

So, how i do this, in past in simple non-laravel based we used .htaccess and in laravel how we will do it.那么,我是如何做到这一点的,过去在简单的非基于 laravel 的我们使用 .htaccess 和在 laravel 中我们将如何做到这一点。

You can change your home directory route in web.php file like this:您可以在 web.php 文件中更改您的主目录路径,如下所示:

Route::get('/', function(){
    return redirect()->route('login');
});

This way, if the user is logged in, he/she will be automatically redirected to home page and anywhere you have chosen for redirection after successful login.这样,如果用户登录,他/她将在成功登录后自动重定向到主页和您选择重定向的任何地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM