nginx
There is likely a better way to do this, but when asked to add a redirect catching some moved wordpress files in nginx, this was what I came up with.
set $fix_redirect "";
if ($request_uri ~ '/wp-content/uploads(.*)') {
set $fix_redirect $1;
}
if ($fix_redirect ~ '^/site/3') {
set $fix_redirect "";
}
if ($fix_redirect != "") {
return 301 "xxx/wp-content/uploads/site/3$fix_redirect";
}
Maybe it will help someone else or possibly there's a better way of doing it that you can let me know?