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

henkie2918's avatar

Laravel 9 middelware "verified" not working on shared hosting

Hi guys,

On localhost when I use the common; php artisan serve. Everything works fine in Laravel with the verified function. I followed the laravel docs/9.x/verification. The function middelware "verified" on a route works just works fine on localhost. The point is, I login, but I am not verified, so I get redirected to a route with the name "verification.notice".

This is put in the routes/web.php folder. Route::get('/dashboard', function () { return view('dashboard'); })->middleware(['auth', 'verified'])->name('dashboard');

So when I want to go to /dashboard I go to the route name "verification.notice" (/verify-email).

Now on a shared hosting this doesnt work. I just stick on /dashboard... I get no erros, nothing. Its like verified doesnt exist. And yes everything is uploaded the same. So I doubt its something to do with the code?

Also the path on my shared hosting is;

*domain-name
**laravel/all-the-files-of-laravel
**demo/laravel-public-files

Yes, its on a subdomain.

Any of you guys have ideas?

0 likes
11 replies
tykus's avatar

Is this something you added after the app was in production? Are the routes cached on the production server?

henkie2918's avatar

@tykus Everything is still under production. So I added this as an update after a few other updates before.

So I also logged into SSH. And went to the laravel folder and typed; php artisan cache:clear.

Did I answer your question?

henkie2918's avatar

@tykus Didnt work sadly :(.

I did; php artisan route:list. Maybe it can give some hints to the problem..

GET|HEAD / ..................................................................................................................... POST _ignition/execute-solution .............. ignition.executeSolution › Spatie\LaravelIgnition › ExecuteSolutionController GET|HEAD _ignition/health-check .......................... ignition.healthCheck › Spatie\LaravelIgnition › HealthCheckController POST _ignition/update-config ....................... ignition.updateConfig › Spatie\LaravelIgnition › UpdateConfigController GET|HEAD api/user .............................................................................................................. GET|HEAD confirm-password ........................................... password.confirm › Auth\ConfirmablePasswordController@show POST confirm-password ............................................................. Auth\ConfirmablePasswordController@store GET|HEAD dashboard ................................................................................................... dashboard POST email/verification-notification ................ verification.send › Auth\EmailVerificationNotificationController@store GET|HEAD forgot-password ............................................ password.request › Auth\PasswordResetLinkController@create POST forgot-password ............................................... password.email › Auth\PasswordResetLinkController@store GET|HEAD login .............................................................. login › Auth\AuthenticatedSessionController@create POST login ....................................................................... Auth\AuthenticatedSessionController@store POST logout ........................................................... logout › Auth\AuthenticatedSessionController@destroy GET|HEAD lolol ................................................................................................................. GET|HEAD register .............................................................. register › Auth\RegisteredUserController@create POST register .......................................................................... Auth\RegisteredUserController@store POST reset-password ..................................................... password.update › Auth\NewPasswordController@store GET|HEAD reset-password/{token} ............................................. password.reset › Auth\NewPasswordController@create GET|HEAD sanctum/csrf-cookie ................................. sanctum.csrf-cookie › Laravel\Sanctum › CsrfCookieController@show GET|HEAD {account}./user/{id} .................................................................................................. GET|HEAD verify-email .................................... verification.notice › Auth\EmailVerificationPromptController@__invoke GET|HEAD verify-email/{id}/{hash} .................................... verification.verify › Auth\VerifyEmailController@__invoke​

tykus's avatar

@henkie2918 can't see the middleware(s)m use:

php artisan route:list -v --name=dashboard
henkie2918's avatar

@tykus This is the output

GET|HEAD       dashboard ............................................................................................... dashboard
                 ⇂ web
                 ⇂ App\Http\Middleware\Authenticate
                 ⇂ Illuminate\Auth\Middleware\EnsureEmailIsVerified
tykus's avatar

@henkie2918 either the User class is different (does not implement MustVerifyEmail) or it must be that the User on production is actually verified then 🤷‍♂️

henkie2918's avatar

@tykus Thanks for your input man! it implements MustVerifyEmail on local tho. So idk why it wont work on server. And I checked that the user isnt verified. So idk too. Maybe the folder rights...🤷‍♂️

tykus's avatar

@henkie2918

it implements MustVerifyEmail on local tho

What about on the production server?

henkie2918's avatar

@tykus Yes, sorry for the confusion. I ment everything works 100% good on local. And I just copy paste the files into the production server, expecting it to be the same... Only files that get changed is the .env (APP_URL gets changed). And the public/index.php. So I am really clueless what is going wrong. Since the middleware 'Auth' works just fine. I just cant find a problem.

cr8's avatar

have you tried php artisan make:auth on your production server

Please or to participate in this conversation.