Image paths wrong after migrating with wp-migrate-db-pro media files add-on

I'm having trouble creating a staging site from an existing production site. When pulling media files using WP Migrate DB Pro 1.8.1 with the Media Files add-on v1.4.9, I can successfully populate my media library with the media from the original site, but for whatever reason all the paths are wrong - so pages with images pointing to /wordpress/wp-content/uploads/.../ cannot be found, because the image have all been pulled into /app/uploads/2018/.../.

If anyone has come across this problem and has found the solution please let me know (apart from re-uploading each image... this particular site has ~3,000 images).

Thanks!

Topic media-library uploads migration staging plugins Wordpress

Category Web


I recommend using Search & Replace DB, a free tool by Interconnect, to replace any instances of the host name in the database. It will handle setting the serialized data correctly for you.

First make sure that your wp-config is for the right database.

You need to go into your new database and change the site url and home url to the new address. I suggest NOT doing this through phpmyadmin though as it will cause some problems.

Go get this tool: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

Upload it into your www/ folder. (I usually rename the search and replace folder to SRDB.)

now navigate to your site with the SRDB at the end. (www.example.com/SRDB)and the top two lines you'll see a search field and a replace field. (if you get a db connection error here, double check the wp-config to ensure that it has the right credentials). In the search place your old site address: /wordpress/wp-content/uploads/.../

in the replace field place your new url /app/uploads/2018/.../

hit live live run.

ONLY do this after ensuring you're on your new url and that it's loaded into your new database.

Remove the SRDB folder when you are done.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.