user1679267 user1679267 - 7 months ago 61
PHP Question

MethodNotAllowedHttpException redirect to home page

is it possible to redirect user to home page when ever MethodNotAllowedHttpException occurs in laravel 5 or which template i should modify to edit the display of MethodNotAllowedHttpException

Answer

rfc2616 10.4.6 405 Method Not Allowed

in Laravel if you specify your .env

APP_ENV=production
APP_DEBUG=false

and create

resources/views/errors/405.blade.php

it will render that file each time an 405 code occurs, i don't think the redirect is possible , but you can always add some javascript into 405 error template for the user to be redirected.

setTimeout(function(){ window.location.href='/'; },10000);