On a Wordpress site running on Nginx, I am trying to redirect a single image to a page.
/image/path/image.jpg => /page/to/redirect/to
A couple of things I have tried within nginx server block (after each config change, restarted the server):
rewrite /image/path/image.jpg /page/to/redirect/to redirect;
rewrite ^/image/path/image.jpg$ /page/to/redirect/to redirect;
location /image/path/image.jpg {
rewrite /image/path/image.jpg /page/to/redirect/to redirect;
}
location /image/path/image.jpg {
return 301 https://example.com/page/to/redirect/to;
}
I was wondering if anyone else had come across the same issue, and could point me in the direct to resolve this.