Search code examples
laravellaravel-5homestead

New Laravel project, /login is forbidden


There are a couple of questions like this, but none of them worked for me.

I have a new project in Laravel. I created new /register route, works perfectly. But /login is not working. I'm getting 403 Forbidden error and nginx/1.13.3 beneath. I tried adding new .htaccess file in the root of the project and it didn't work. I have a project that I created couple of months ago, with the same route /login and it still works perfectly, with no .htaccess fine in root.

I'm using Homestead machine as the server and I have Laravel 5.6.1. project.

And, no matter what I do, the same error is still there. I can remove the route, the controller or the view (just to provoke new, familiar error) but still the same one.

Any ideas what is going on?


Solution

  • First, nginx doesn't need an .htaccess file. It exists for apache users in new Laravel projects.

    Second, Laravel has the authentication routes builtin, you shouldn't need to create login and register routes. Run:

    php artisan make:auth
    

    to scaffold your auth routes and views. Try removing the /register route you created and run the above command.