0

I am looking for a miracle. I highly doubt there's a way to do this but just thought I'd ask:

I've been managing a multisite install on an old outdated server with old outdated pieces. We just spent up a new one with all new software to start anew. When you read the rest of this, I'm sure you'll have many questions as to what happen. Just know that it's a long story and I'm not interested in fleshing our details as to why I did certain things.

So I installed a fresh new WP installation and those who are on my multisite are creating a new site on the new install, exporting their information and importing to the new server. As you would expect, there are tons of broken links because the directory setup has changed. These broken links are on pages and posts. So, for instance, an old link file (or image) would be

www.example.com/files/2016/5/document.pdf

If I were to update this manually to make it work, I'd change it to

www.example.com/wp-content/uploads/sites/#/2016/5/document.pdf

where "#" is their site id. So to not have to do each link manually, is there auto-magical way to do this?

  • 2
    It might be helpful to add a sample 'old link' and 'new link' to your question. And info about where the broken links are - in posts, in pages, media links, etc. That info will help determine an answer. For instance, if just broken URLs (old domain vs new domain), a plugin like Better Search and Replace might help. – Rick Hellewell Aug 29 '18 at 18:46
  • 2
    WP CSV is a great plugin for dumping WP post data to easily manipulate as a spreadsheet and then re-importing the corrected data. If the edits are all similar, such as updating a domain name or path in every URL, then a DB search and replace tool that handles serialized data would be a good choice.interconnectit.com/products/… As always, make backups first and test in a non-production environment. – jdm2112 Aug 29 '18 at 18:49
  • @rickHellewell I just edited my post. Sorry for being vague. – athomas Aug 29 '18 at 19:08
  • @jdm2112 Who is it made by? – athomas Aug 29 '18 at 19:10
  • wordpress.org/plugins/wp-csv – jdm2112 Aug 29 '18 at 20:51
2

It seems from your example that the key parts of the URL structure are staying the same.

2016/5/document.pdf

That means you could use a plugin like 'Better Search Replace' (https://en-gb.wordpress.org/plugins/better-search-replace/).

Simply choose to replace:

www.example.com/files/ with www.example.com/wp-content/uploads/sites/#/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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