找到app/Exceptions这个目录下的Handler.php文件
添加:
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
找到render方法:
if ($exception instanceof MethodNotAllowedHttpException || $exception instanceof NotFoundHttpException) {
if (!($request->ajax() || $request->wantsJson())) header("Location:".config('local.url').'404.html');die;
}