302 301 redirect custom HTML content

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

302 301 redirect custom HTML content

Eugene Piatenko
Hello!

I'm trying to
1. send people to home page if they enter wrong place (404)
2. it works, but HTML content with headers is:

HTTP/1.1 302 Moved Temporarily
Server: nginx/1.10.3
Date: Thu, 23 Mar 2017 11:38:08 GMT
Content-Type: text/html
Content-Length: 161
Connection: keep-alive

<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx/1.10.3</center>
</body>
</html>


Is it possible to send custom page content?

My config:

server {
  listen 80;
    root /somewhere/mysite;
  location @redirect_to_home {
  error_page 302 /custom_302_page.html;
  return 302 /myhomepage.html;
  }
  error_page 404 = @redirect_to_home;
}


Thanks for the advise!


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Loading...