Redirect 404 Errors to Homepage with Nginx

Posted on March 5, 2019 at 7:21 pm

You can redirect 404 errors to homepage with Nginx.

To do so, just add this inside server {}:

# Redirect 404 errors to homepage
error_page 404 = @myownredirect;
# My custom 302 redirect to homepage
location @myownredirect {
    return 302 /;
}

Make sure that if you use fastcgi you have:

fastcgi_intercept_errors on;

Receive updates via email

Other Posts

Updated Posts