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

mstenquist's avatar

Can't seem to load the login or register auth views

So here's my problem..

I used php artisan make:auth to stub out the scaffolding for user authentication.

I'm trying to navigate to /login via an anchor tag <a href={{ route('login') }}">Login</a> which is currently located in layouts/app.blade.php - route('register) is also having the same problem.

When I run php artisan route:list...

I see...

GET|HEAD   login      App\Http\Controllers\Auth\LoginController@showLoginForm                
GET|HEAD   register  App\Http\Controllers\Auth\RegisterController@showRegistrationForm

The problem I'm having is that neither of the anchors are bringing me to the login or register views. The page just reloads and I'm stuck on the homepage. Both the login and register views are correctly extending the layouts.app view. I know this is a bit vague but I'm really baffled.

When I hover over the links the url does say /login and /register as expected.

I am getting an error that says "requested page not found"

0 likes
5 replies
Devon's avatar

What happens when you manually go to /login or /register? Does it load the page correctly?

Is this a new project? What version of Laravel are you running?

(Note: You missed the first quote in your href... href={{ should be href="{{)

mstenquist's avatar

Navigating to both /login and /register manually do the same thing.

This is a new project. Laravel is version 5.4.12

Sorry about the typo, the missing " isn't an issue in the code.

This is what my HTML looks like..

    @if (Auth::guest())
        <li>
          <a href="{{ route('login') }}">
            Login
          </a>
        </li>
        <li>
          <a href="{{ route('register') }}">Register</a>
        </li>
        @else
          <li>
            <a href="{{ route('logout') }}"
                onclick="event.preventDefault();
                         document.getElementById('logout-form').submit();">
                Logout
            </a>
            <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                {{ csrf_field() }}
            </form>
          </li>
        @endif
Devon's avatar

Are you currently logged in? Neither page should be accessible if you are.

Try clearing your cookies then going to '/login'.

mstenquist's avatar

I figured it out after all... I just had to move reorder my routes. Moving the /{slug} route below Auth::routes(); did it.

Auth::routes();

Route::get('/{slug}',['as' => 'post', 'uses' => 'PostController@show'])->where('slug', '[A-Za-z0-9-_]+')

Thanks for your time and input! Happy coding! :)

Devon's avatar

Ahh, that's kinda what I was wondering when I asked if it was a new project. Guess I should have elaborated a bit... :/

Anyway, glad you got it working!

Please or to participate in this conversation.