Hi,
Is there any way I can 301 redirect a lot of (>10k) old urls to new urls
in nginx conf?
Writing 10k lines of rewrite rules seems to be not efficient as those
rules will get checked for every single request.
I’m thinking of some data structure like dict in python which can have a
quick look up of the key and then do the redirect of the value. The
question is how can I do that in nginx?
Thanks a lot!
Posted at Nginx Forum:
Perhaps you can just pass it using fcgi to a lookup script that performs
the
redirect.
On Aug 4, 2011 11:51 PM, “zflairz” [email protected] wrote:
Thanks a lot!
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,213410,213410#msg-213410
Use a map :
map $uri $new_url {
defau;t 0;
/old/url /new/url
/1 /new/1;
}
then in your server config:
if ($new_url) {
rewrite ^ $new_url permanent;
}
Thank you. I’m doing exactly the same (as also suggested by others in
another thread) 
Posted at Nginx Forum: