Welcome! Log In Create A New Profile

Advanced

302 301 redirect custom HTML content

Eugene Piatenko
March 23, 2017 08:00AM
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
Location: http://mysite/myhomepage.html
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
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

302 301 redirect custom HTML content

Eugene Piatenko March 23, 2017 08:00AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 300
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready