I want nginx to handle 404 error status and redirect them to another domain. In headers "Location:" is updated but status is still 404 but should be 301. Here is my code :
# error handling error_page 404 @404; log_not_found off; proxy_intercept_errors on;
and :
location @404 {
rewrite ^ http://www.example.com/404.html? permanent;
}
So following command lynx -head -dump 'http://localhost:9999/a_404_error' gives me :
HTTP/1.1 404 Not Found Server: nginx/0.8.54 Date: Mon, 11 Apr 2011 18:59:12 GMT Content-Type: text/html Content-Length: 169 Connection: close Location: http://www.example.com/404.html
Any idea ?