我想nginx处理404错误状态,并将其redirect到另一个域。
在标题“位置:”被更新,但状态仍然是404,但应该是301。
这是我的代码:
# error handling error_page 404 @404; log_not_found off; proxy_intercept_errors on;
和:
location @404 { rewrite ^ http://www.example.com/404.html? permanent; }
所以下面的命令lynx -head -dump 'http://localhost:9999/a_404_error'给了我:
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
任何想法 ?
我终于这样做了:
error_page 404 http://www.example.com/404.html
它提供了一个302代码,只是工作
error_page 404 = @ 404将允许位置@ 404设置响应状态