Remove /sites/25/ from image URLS

I assume you want to internally rewrite the URL, rather than externally redirect the request…

To rewrite the image URL-path to remove /sites/25 for the espanol subdomain only then try something like the following using mod_rewrite at the top of the .htaccess file, before the WordPress front-controller:

RewriteCond %{HTTP_HOST} ^espanol\.
RewriteRule ^(wp-content/uploads)/sites/25/(\d{4}/\d\d/[\w-]+\.jpg)$ /$1/$2 [L]

Following /sites/25/, the source URL-path is assumed to be of the form of 4-digits, slash, 2-digits, slash and any number of word characters (\w) including the hyphen and then .jpg. (\w being a shorthand character class for a-z, A-Z, 0-9 and _.)

UPDATE: I also need the “espanol” subdomain removed during the rerwrite.

You can’t do that with a simple rewrite. You can’t URL-rewrite across hosts. You would either need to configure your server as a reverse proxy and proxy the request using mod_proxy. Or implement this as an external redirect instead.

For example, as an external redirect:

RewriteCond %{HTTP_HOST} ^espanol\.(.+) [NC]
RewriteRule ^(wp-content/uploads)/sites/25/(\d{4}/\d\d/[\w-]+\.jpg)$ https://%1/$1/$2 [R=302,L]

This does assume you don’t have other domains that share the same “espanol” subdomain.

The %1 backreference (note the % prefix) in the RewriteRule substitution holds the hostname less the espanol. prefix.

Change the 302 (temporary) to 301 (permanent) – if that is the intention – only after you have tested that this works OK for you. 301s are cached persistently by the browser, so can making testing problematic.