File URL of media that has been uploaded befor mapping domain

Hello,

I've just realized (when using the plugin smush it) that when I setup an website on multisite (mydomain.com/newdomain) and build the whole website there and also include pictures etc. the file URL of pictures und media stays the same after I map this website to the real domain (newdomain.com).
I'd like to run "smush it" to reduce image size but that only works if the mediafiles are from the new domain. Also I could imagine that concerning SEO that is not perfect, if the images are included from the main domain - I guess?!

So to my question - do you know a way, I can (automatically - if possible) change the file URLs to the new domain?

Thanks in advance & greetings!