0

I've rebuilt an old website from scratch on a fresh install.

On the old (production) website there are over 1000 PDFs and Word docs. These have been uploaded over a 3 year period via /wp-content/uploads/. Files are organised by year and month: /2019/01/filename.pdf, for example.

The new website has a different sitemap. 301 redirects are in place to direct the old posts/pages to the new.

Many of the files which need migrating are attached to posts/pages on the old website. The majority of these posts/pages no longer exist on the new website.

I need to migrate the PDFs and Word docs over to the new website which currently sits on a staging server.

The main objectives are:

  1. Maintain the old file directory structure, e.g. /2019/01/filename.pdf.
  2. Only migrate documents (PDFs, Word docs, txt files etc). Imagery and video is not required.

What's the best way to achieve this?

I've looked into WP Migrate DB Pro, but it looks like this migrates all media files.

2
  • I haven't tried this myself, but you could simply upload them via FTP/SSH and then use the Add from Server plugin to let WP know they exist. This will work for all absolute & relative links that exist within your pages, but if somewhere something references them only via their attachment ID, this will break.
    – kero
    Dec 16, 2021 at 14:33
  • 1
    I think this is a great solution. Did you want to post this as an answer?
    – Sam
    Dec 16, 2021 at 16:13

1 Answer 1

1

I haven't worked this way myself, but a possible solution would be:

  1. Upload all of the assets via FTP / SSH / ... to the webserver.
  2. Import the assets e.g. via Add From Server plugin.

Doing a quick web search, a lot of tutorials (maybe outdated?) still refer to this plugin for this specific task. It's last update was ~1y ago - but handling of media files shouldn't have changed that much.

Make sure to test it on a staging/dev site before doing anything on production!

If you have absolute & relative links to the assets, they will continue working. If you reference the attachments by their ID, these will likely not work anymore, as the IDs are going to change.

0

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.