Configuring Custom Error Pages in Nginx: Custom 404 page

Posted by

There are certain cases when we want to avoid showing 404 Error pages , or want to show some custom Error pages. So this can be achieved using nginx rule.

Upon searching for a while, I found many ways to do the trick. But the following method did worked for me. My requirement was to redirect all 404 pages of a wordpress website to its homepage. The same way you can redirect any errors/ error pages using the following rules.

There are many more ways to define the custom error page, but none of them including above didn’t worked until i added,

This was doing the background work.
It allows nginx to intercept or deal with the request when the fastCGI server repond to the particular response with any error code (ie: http response codes > 300).

From Nginx Documentation:


  1. Can I just say what a relief to seek out somebody who truly knows what theyre speaking about on the internet. You undoubtedly know how one can convey an issue to mild and make it important. More folks have to read this and perceive this aspect of the story. I cant believe youre no more well-liked since you definitely have the gift.

  2. I have read several excellent stuff here. Definitely price bookmarking for revisiting. I wonder how much attempt you set to make such a fantastic informative web site.

  3. I’ve been absent for some time, but now I remember why I used to love this web site. Thanks, I’ll try and check back more often. How frequently you update your site?

    1. Hi, being straightforward, just a plugin can’t make a site secure. All components – backend to frontend have a role in this. I will be posting an article soon on securing WordPress sites.
      Stay tuned.

Leave a Reply

Your email address will not be published. Required fields are marked *