If you have a very long list of entries, it might be a good idea to leave them outside the nginx configuration file:
map_hash_bucket_size 256; # see http:
/etc/nginx/oldnew.map :
/my-old-url /my-new-url; /old.html /new.html;
Be sure to end each line with a ";" char!
Also, if you need to redirect all URLs to another host, you can use:
return 301 http://example.org$new_uri;
Or, if you also need to redirect to another port:
return 301 http://example.org:8080$new_uri;
source share