Search & Replace hack (6 posts)

  1. lunadust
    Posted 11 years ago #

    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. http://example.com/blog/1.jpg) but I replace all the old links with relative path links (i.e. 1.jpg). Any ideas?

  2. Mark (podz)
    Support Maven
    Posted 11 years ago #

    This would need you to run an sql query to do all the search/replace for you.

  3. kristin
    Posted 11 years ago #

    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 http://sub.example.com to http://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

  4. Anonymous
    Posted 11 years ago #

    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.
    and I want those links to look like this:
    I. e. I want to change all occurrences of:
    or better yet, just to point to my site root.

  5. likoma
    Posted 11 years ago #

    Found this and it worked great:


    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.

  6. glytch
    Posted 10 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.