Home >Operation and Maintenance >Nginx >How does Nginx realize 404 automatically jump to the home page?

How does Nginx realize 404 automatically jump to the home page?

WBOY
WBOYforward
2023-06-03 10:16:321250browse

404 automatically jumps to the homepage

server {
 location / {
  error_page 404 = @ops-coffee;
 }

 location @ops-coffee {
  rewrite .* / permanent;
 }
}

The 404 page on the website is not particularly friendly. We can use the configuration above to automatically jump to the homepage after the 404 appears.

The above is the detailed content of How does Nginx realize 404 automatically jump to the home page?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete