Programming

laravel nginx error redirect

Started by dddread · Oct 21, 2025

#11655
is it even possible to redirect on nginx/laravel every error to some error page

so basicly if i wanna test security of my site and make error on some page is it and how is it possible to redirect all error 404/405/406 ... /500/...

to 1 error page

i had edit handler.php, web.php, laravel.conf, make controller errorcontroler.php idk what did i try but nothing work??

need help
#11656
↳ Replying to @dddread
I would not recommend this. In Laravel you can customize your error pages by publishing with the tag laravel-errors.

You can have an absolutely silly catch-all in NGINX like so...


location {
error_page 400 401 402 403 404 .... 500 501 502 503 ... @errorHandler;

location @errorHandler {
# Route to a file, proxy, etc
}
}


You can also set different errors individually:


error_page 400 /400.html;
error_page 401 /401.html;