ホーム > Laravel > How to Solve 404 Errors on Login and Registration Pages in Laravel
Laravel

How to Solve 404 Errors on Login and Registration Pages in Laravel

Thank you for your continued support.
This article contains advertisements that help fund our operations.

This article summarizes how to solve 404 errors when login and registration pages do not display in a Laravel project.

Solution

Laravel UI

Add the following line to routes/web.php:

Auth::routes();

Breeze

In Breeze, the necessary routes are written in routes/auth.php and are called in web.php.

routes/web.php

require __DIR__.'/auth.php'; // Without this line, the login page returns a 404

JetStream (Fortify)

You can change the configuration in config/fortify.php by setting false to true to display the views.

'views' => true

Steps for Troubleshooting

First, Check the Current Routes

The most common reason for a 404 error when pages do not display is that the routes are not defined.

Run the following command to display the list of currently available routes:

php artisan route:list

If the login or registration pages are not in the list, try the methods mentioned above.

When the Page Displays as a Blank Screen

First, check for errors in the browser console.

To display the console in the browser:

Command + Option + I (Mac)
Ctrl + Shift + J (Windows)

Check for any errors.

If you see an error like:

localhost:5173/app.css 404

This likely means that Vite is not running.

Run the Vite development command:

npm run dev

Conclusion

That's all.

I hope this article helps someone.

Please Provide Feedback
We would appreciate your feedback on this article. Feel free to leave a comment on any relevant YouTube video or reach out through the contact form. Thank you!