In laravel 9 with Fortify Authentication I see in routes
GET|HEAD login ................................................................................................................................................... login › Laravel\Fortify › AuthenticatedSessionController@create
POST login .............................................................................................................................. generated::kNTXAE1j2bp8Zq09 › Laravel\Fortify › AuthenticatedSessionController@store
and my login page is opened by “/login” url.
How can I to make this login as “/admin/login” url?
Leaving all Fortify functionality as it was before?
Thanks!
There is also a more personalized option where you can rename any route separately. Add the following lines in config/fortify.php, inside of the returned array:
return [
// existing settings here
'paths' => [
'login' => '/admin/login',
],
];
You can do this with all named routes.
In your FortifyServiceProvider in the boot() method, you should add
Fortify::ignoreRoutes();
before the default configuration.
It will tell Fortify to ignore the build-in routes.
Then you should copy Fortify's routes (./vendor/laravel/fortify/routes/routes.php)
to your own routes (./routes/web.php) file.
Then in your web.php file you can make changes accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With