0

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!

1 Answer 1

0

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.

1
  • My issue isn't with the url, that was updated correctly - what was wrong was the path, or the "directory," so all the media get uploaded to <domain>/app/uploads/, when it should be uploaded to <domain>/wordpress/wp-content/uploads/ Feb 27, 2018 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.