WordPress

> Nginx prod folder redirect for local WordPress uploads folder

set $production your-prod-server.com;

# Redirect requests to /wp-content/uploads/* to production server
location @prod_uploads {
        rewrite "^(.*)/wp-content/uploads/(.*)$" "https://$production/wp-content/uploads/$2" break;
}

# Rule for handling local requests for images
location ~ "^/wp-content/uploads/(.*)$" {
        try_files $uri @prod_uploads;
}

```