jeudi 21 mai 2015

How to configure custom 403 view in Laravel 4

Currently I got set the error pages on start/global.php as it is recommended in Laravel docs.

Here is the code:

App::error(function(Exception $exception, $code)
{
    if ( ! Config::get('app.debug'))
    {
        $view = (View::exists("error/{$code}")) ? "error/{$code}" : "error/404";
        return Response::view($view);
    }
}

where my views are

app/views/error/*

I have successfully tested 503, 500 and 400 but error page 403 is showing default apaches default as shown in the image:

enter image description here

Not sure why this is happening

Probably I testing 403 page the wrong way... I know that I can test page 403 if run App::abort(403), but I'm looking for a way to verify its working on a real case.

Maybe I got an Apache configuration that's crashing with Laravel custom error pages?

Thanks in advance,

Aucun commentaire:

Enregistrer un commentaire