Routing Laravel 8 Laravel 9 Laravel 10 Laravel 11 Laravel 12

405 Method Not Allowed in Laravel - Route Fix

This error occurs when you try to access a route with an HTTP method that the route doesn't support.

The Error

Error Message
405 Method Not Allowed

Common Causes

  1. 1 Submitting form with wrong method
  2. 2 Route defined as GET but accessed via POST
  3. 3 Missing method spoofing for PUT/PATCH/DELETE
  4. 4 AJAX request using wrong HTTP verb

Solutions

1

Match form method to route definition

PHP
// Route
Route::post('/posts', [PostController::class, 'store']);

// Form
<form method="POST" action="/posts">
2

Use method spoofing for PUT/PATCH/DELETE

Blade
<form method="POST" action="/posts/1">
    @csrf
    @method('PUT')
    <!-- or -->
    <input type="hidden" name="_method" value="PUT">
</form>
3

Check your routes

Bash
php artisan route:list

Need Help With Your Laravel Project?

I specialize in building custom Laravel applications, process automation, and SaaS development. Whether you need to eliminate repetitive tasks or build something from scratch, let's discuss your project.

Currently available for 2-3 new projects

Hafiz Riaz

About Hafiz

Full Stack Developer from Italy. I build web applications with Laravel and Vue.js, and automate business processes. Creator of ReplyGenius, StudyLab, and other SaaS products.

View Portfolio

Related Errors