return 404 from map module default value
zflairz
nginx-forum at nginx.us
Fri Aug 5 13:21:11 UTC 2011
I'm using map module to redirect URLs which have been removed (but
indexed by search engine).
But how can I fall back to http 404 response for urls not present in my
redirect list?
I've tried following, but I got 200 instead of 404:
location ~* ^/404$ {
return 404;
}
error_page 404 = /404.html;
map $uri $redirected_uri {
default /404; #here?
include /etc/nginx/redirected_uri.txt;
}
location ~* ^/.+ {
if (!-f $request_filename) {
rewrite ^ $redirected_uri permanent;
}
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,213431,213431#msg-213431
More information about the nginx
mailing list