• Resolved woodypad

    (@woodypad)


    Hi,
    thanks for your plugin.
    I need to make Test copies of my site, but I would like all the Media URLs to remain with the original URLs on the production site.
    This is because my upload folder is over 60GB so I can’t copy everything to create a test site.
    I wonder how I can create a copy of the site by changing all the URLs except the media ones?
    Thank you

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor bcrodua

    (@bcrodua)

    Hi,

    To keep the URL the same you will have to skip/deselect the “Search and Replace database” option. After the restore the links for the images will point to the original source site. Our restoration guide is here.

    Thanks,
    Bryle

    Thread Starter woodypad

    (@woodypad)

    Hi,
    Thanks for the reply, I did but I think I’m doing something wrong.
    I started the restore, and unchecked “search and return” of the database, but once completed, the site was inaccessible and redirected to the original site.

    Maybe only one table needs to be deselected?
    You can explain.
    Thank you

    Magic Trashcan

    (@magictrashcan)

    Doing a full restore and changing only the media urls to the old site afterwards seems like a more promising approach.

    Thread Starter woodypad

    (@woodypad)

    Hi @magictrashcan,

    thanks for your reply, it seems like a good solution, sorry, but how do I restore the media URLs?

    Thank you

    Magic Trashcan

    (@magictrashcan)

    Off of the top of my head, I did not test it but this approach should work:

    Log on to your SQL, search and replace all urls in the wp_posts table. You may need to adjust the script to your respective table prefix (where it says wp_posts).

    UPDATE wp_posts SET post_content = replace(post_content, 'https://www.stagingurl.com/wp-content/uploads', 'https://www.liveurl.com/wp-content/uploads');

    The key is to only update the links that include the wp-content/uploads bit. That leaves all other urls intact.

    All images loaded in your posts/pages should now be loaded via the live url.

    Not 100% sure if there are theme files that may need updating in another place but you can repeat the above code on any table/cell.

    That being said, always take a backup before fiddling around with the database, even if it’s just a staging site. Saves you a lot of trouble.

    Thread Starter woodypad

    (@woodypad)

    Hi @magictrashcan
    thanks for your reply and your solution!

    I thought there was something in the plugin that needed to be deactivated so as not to have to be rewritten.

    I will try your code thanks!

    Plugin Support vupdraft

    (@vupdraft)

    Not keeping the option to search and replace checked would have been the cause of this. We do have a guide for such occurences: https://updraftplus.com/faqs/migrated-site-searchreplace-database-can-now/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Do not change Media URLs’ is closed to new replies.