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

Advenced-tech-solution's avatar

The POST method is not supported for route admin/login. Supported methods: GET, HEAD.

Hi All,

I was trying to deploy a laravel project on web hosting. My project is correctly run on my local server. When I deploy on my web hosting by config the env and database connection. everything is good and login form is appear when I route my admin.example.com /public/. But, after i fill correct useremail and password and click the login button (submitting the data), 'Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException "The POST method is not supported for route admin/login. Supported methods: GET, HEAD." Error is Occuring.

I am using Laravel 11, Filament 3 and laravel-sanctum for auth. I did not use customize form and method for Login and register form for admin dashboard. I use only Filament's login form.

My route in web.php is as per below.

0 likes
12 replies
shariff's avatar

In server you need to clear the cache.

php artisan route:clear
php artisan config:cache
1 like
Tray2's avatar

Sounds to me like that your document root isn't pointing to the public directory.

It should point to something like this. /var/www/html/public

And not something like /var/www/html

2 likes
Advenced-tech-solution's avatar

@Tray2 Could you please tell me more detail? For the first time , when i call my subdomain 'dashboard.example.com' it does not reach to /public and showing the folders. After I made some changes in .htaccess file, the url reach /public automatically when I call my subdomain 'dashboard.example.com'. Example : I call, " dashboard.example.com'' it redirect 'dashboard.example.com/public" and show the login form that i redirect in route/web.php. The final route is ' dashboard.example.com/public/admin/login' and it show the login form. but when I submit the user email and password, the error "The POST method is not supported for route admin/login. Supported methods: GET, HEAD." is appear.

Is there any solution for this?

Thanks for your time and reply.

Advenced-tech-solution's avatar

@Tray2

The route is work and when i call my subdomain dashboard.example.com it redirect dashboard.example.com/public/admin/login and show the login form.. the error is only show once I submit the user email and password .

My Route -.> Route::get('/', function () { return redirect(route('filament.admin.auth.login')); })->name('login');

Is there any suggestion and solution for it. Thanks

JussiMannisto's avatar

@Advenced-tech-solution First off, use three backticks to format any code you post:

```

Your code here

```

Then show your web server configuration and the route definition for admin/login.

After I made some changes in .htaccess file

What changes did you make and why?

Tray2's avatar

@Advenced-tech-solution The public should never show up in the url.

This dashboard.example.com/public/admin/login should be this dashboard.example.com/admin/login

1 like
Advenced-tech-solution's avatar

@Tray2 Thanks, now the domain and document root is OK and when i call dashboard.example.com, it redirect to dashboard.example.com/admin/login and show the login form. After, make some changes in configs file and add ' protected $except = [ // 'livewire/*', ];' in VerifyCsrfToken.php, the POST method not allow and Page expire error does not occur. But , the issue is change , which is when I login with correct user email and password, the route does not change to /admin and it is redirect to login page.

Thanks for your times and suggestions sorry for my English writing.

Tray2's avatar

@Advenced-tech-solution Sounds to me like you have made too many changes, and gotten lost. I recommend creating a new project with the proper document root, and then move the code over in small portions.

There is probably something wrong in your code, but it's hidden among all the config changes you've made.

1 like
JussiMannisto's avatar

@Tray2 Agree.

@advenced-tech-solution You normally don't need to change anything when deploying a Laravel app. You don't need to touch .htaccess. You definitely don't need to add CSRF exceptions. It doesn't involve hacking or trying out random stuff. You just need to configure your web server correctly.

Please or to participate in this conversation.