• Hi I’ve been searching the Support Forum but don’t seem to be able to find a hack to search and replace. Reason is my old links were absolute (i.e. https://example.com/blog/1.jpg) but I replace all the old links with relative path links (i.e. 1.jpg). Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • This would need you to run an sql query to do all the search/replace for you.

    I had this problem when I moved my website from a subdomain to a top level domain.
    What I did was:
    Exported my database with phpMyAdmin (adding drop tables helps)
    Used find/replace in notepad to replace all of https://sub.example.com to https://www.newdomain.com
    Saved as a new file to keep my old database backed up just incase ??
    Used phpMyAdmin to import the modified sql file

    Is there anyone who can post the layout of such a query?
    I have on my site a lot of links to images on another server, since moving the site from a blogger-site hosted in a sub folder.
    example:
    http:/the_other_server.com/my_folder/img/image.jpg
    and I want those links to look like this:
    https://my_new_domain.com/img/image.jpg
    I. e. I want to change all occurrences of:
    http:/theotherserver.com/myfolder/
    to:
    https://my_new_domain.com/
    or better yet, just to point to my site root.
    Thanks
    Nick

    Found this and it worked great:

    https://www.2020hindsight.org/2004/07/07/searching-and-replacing-within-phpmyadmin/

    It’s basically this code in PHP MyAdmin, click SQL:

    update 01_posts set post_content = REPLACE(post_content, "what I want to replace", "the replacement text");

    I use numbers “01” instead of “wp” for my multiple installs, so make sure to change that prefix to the tables in question.

    thanks for that! I needed a way to change the url from some remote hosted images to some locally hosted and this did the trick.
    it’s a shame there isn’t a mass search and replace plugin , or more likey it’s a shame I couldn’t find it! but now I now how to run queries on myphp so not a bad result.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Search & Replace hack’ is closed to new replies.