Support the ongoing development of →

Technically there is a difference between a not found (with a status code 404) and a not allowed (with a status code 405)

Laravel give you a lot of options for handling exceptions.

An option that can be useful for you is Rendering Exceptions

use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
 * Register the exception handling callbacks for the application.
 * @return void
public function register()
    // This will throw a 404 / not found exception if we try to render a MethodNotAllowedHttpException (like if we do a GET on a POST url.
    $this->renderable(function (MethodNotAllowedHttpException $e, $request) {

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.