How do I reverse Amazon S3 CDN links to WordPress Media files, so they point back to the server’s copy. Using W3 Total Cache

Done extensive googling on this. I setup a CDN to handle huge amount of traffic on a site launch. Now I need to pull the images back to the server, and update links/refs to the files to point back to the local server copy, instead of the CDN.

It’s a standard WordPress install, using W3 Total Cache and a single S3 Bucket.

Read More

Any ideas?

Thanks, Tom.

Related posts

Leave a Reply

1 comment

  1. If you are comfortable working from the command line then this isn’t terribly difficult. Use WP-CLI (http://wp-cli.org) to search and replace values in your database. You will most likely need to do a search/replace for each image you have listed in your database.

    • If they aren’t already there, make sure your copy all the
      images back down to your server and put them where you want them.
    • Use wp-cli to just search your database and find all the
      references to your S3 bucket.
    • Go one by one and replace the S3 url with one that points to
      your local server.

    After you do your first one or two, load a page displaying that image, it should be loading locally.

    wp-cli will search your entire database and even unpack serialized values to search them. it’s a great tool for this kind of task. We use it a lot at getpantehon.com to manage different tasks.

    Cheers!

    =C=