How to set up redirects with nginx?

I’m trying to mask an affiliate link, so I want to have a 302 redirect through nginx

I want to redirect all /go links to the respective affiliate link, so all link redirects would be like redirects to >

I have tried this

location /go/affiliate {
       return 302;

I have also tried using map

map $uri $aff_redirect {
    default            "";
    "/go/affiliate"    "";
    # more links
if ($aff_redirect) {
    return 302 $aff_redirect;

I have tried everything and I cannot seem to be able to get it to work. Is there a specific file I need to do it on?

I have already tried changing on /sites-enabled/default and /conf.d/nginx.conf and /sites-enabled/

Might be a silly question, but have you restarted your NGINX daemon between each edit?

Yes I did, sudo systemctl reload nginx every change I did