Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

k-frame's avatar

Make Laravel login basic page the index of my website?

Hello,

I found on the official documentation how to change the /home redirect but, I can't find where to put my /login page in index.

Like:

Route::get('/', 'LoginController@index')->name('indexpage');

But you know, this controller doesn't exist. I don't really want to change the basic Laravel authentication system, I just want to make the login page the home page of the site for now...

Thank you in advance for your help. Laravel version used : 7.x.

0 likes
6 replies
azeem202's avatar

Your question is not clear, please explain more. What exactly you want to do?

k-frame's avatar

Well sorry.

I would like the home page of my site ('/') become the login page. I don't know if it's clearer... :/

MichalOravec's avatar
Level 75

Normal routes are

Route::get('login', 'LoginController@showLoginForm')->name('login');
Route::post('login', 'LoginController@login');
Route::post('logout', 'LoginController@logout')->name('logout');

Change it to

Route::get('/', 'LoginController@showLoginForm')->name('login');
Route::post('login', 'LoginController@login');
Route::post('logout', 'LoginController@logout')->name('logout');
1 like
siangboon's avatar

the LoginController and other controllers will be scaffold under app/Http/Controllers/Auth/ folder once you installed and enabled the authentication package

composer require laravel/ui

php artisan ui vue --auth

you can simply redirect your root path ('/') to Auth\LoginController or make use of the middleware('auth') at your route or controller constructor and so on...

1 like

Please or to participate in this conversation.