Welcome! Log In Create A New Profile

Advanced

return 404 from map module default value

August 05, 2011 09:21AM
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;
}
}
Subject Author Posted

return 404 from map module default value

zflairz August 05, 2011 09:21AM

Re: return 404 from map module default value

Maxim Dounin August 05, 2011 09:30AM

Re: return 404 from map module default value

Igor Sysoev August 05, 2011 09:34AM

Re: return 404 from map module default value

zflairz August 05, 2011 10:46AM

Re: return 404 from map module default value

Igor Sysoev August 05, 2011 11:46AM

Re: return 404 from map module default value

zflairz August 05, 2011 09:53PM

Re: return 404 from map module default value

António P. P. Almeida August 05, 2011 10:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 105
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready