Nginx - Customizing 404 page

后端 未结 5 2230
无人共我
无人共我 2020-12-07 10:29

Nginx+PHP (on fastCGI) works great for me. When I enter a path to a PHP file which doesn\'t exist, instead of getting the default 404 error page (which comes for any invalid

5条回答
  •  情深已故
    2020-12-07 11:16

    Be careful with the syntax! Great Turtle used them interchangeably, but:

    error_page 404 = /404.html;

    Will return the 404.html page with a status code of 200 (because = has relayed that to this page)

    error_page 404 /404.html;

    Will return the 404.html page with a (the original) 404 error code.

    https://serverfault.com/questions/295789/nginx-return-correct-headers-with-custom-error-documents

提交回复
热议问题