Check your this path app\Http\Controllers\Auth\LoginController.php change the redirect route in Logincontroller,
protected $redirectTo = '/home';
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello Guys !
Just to make clear, I'm a noob in Laravel, my question may sound stupid ahah
I'm currently facing an issue with the prefix routing. I'm not sure if I'm doing it right for the routing, can someone give me some advice ?
Here is the context: My website has 2 front and 1 back. All views will kind of be similar, just some section will disappear. Depending on which urls for the homepage we will have, if the user is not authenticated, it should redirect to the login page.
Urls should be like this:
web.php
Route::group([
'prefix' => 'front1'
], function () {
AuthRoutes();
Route::get('/', 'Front1Controller@index')->name('f1.home');
});
Route::group([
'prefix' => 'front2'
], function () {
AuthRoutes();
Route::get('/', 'Front2Controller@index')->name('f2.home');
});
Route::group([
'prefix' => 'admin',
], function () {
AuthRoutes();
Route::get('/', 'AdminController@index')->name('admin.home');
});
//Auth::routes();
function AuthRoutes()
{
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register');
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');
Route::get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify');
Route::get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');
}
How do I redirect to the right view ? Here is what happened :
No matter which prefix I am at, it will redirect me to the admin/login
How do I fix this ?
Thanks everyone
Please or to participate in this conversation.