Media Library Mess After FTP … /uploads

A media ‘item’ has a URL in the wp-posts database that points to the file location.

If you change domain names, you have to adjust all of the occurrences of the old domain name to the new name…including in the wp-posts database for media URLs.

A search and replace plugin (I like “Better Search and Replace”, but there are other choices) will allow you to change any occurrence of www.olddomain.com to www.newdomain.com .

Backup your database first, of course.