WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to change Image URL's after WP Move (7 posts)

  1. DougJay
    Member
    Posted 6 years ago #

    HI. I have moved my WP installation on my server into the root folder. It was in a folder caller wp/ now it is in my root. The move has gone good and I have followed the "how to" but I have run into a small problem.

    Blog: http://www.gverstraete.com

    When you click on any image that has been used on any of my pages to see the larger view I get a server error.

    When I go to admin > Manage > Uploads
    Most of my images have the wrong address. It is still has the address:

    http://www.gverstraete.com/wp/wp-content/uploads/2007/11/catno007.JPG

    It should be:

    http://www.gverstraete.com/wp-content/uploads/2007/11/catno007.JPG

    I have loged into my PHPmyAdmin and all the setting say http://www.gverstraete.com

    But when I check them out in Manage > Uploads The image is "x" out and has the old address with the /wp in it.

    How can I change all my images URLs to the new address?

    I have searched and can not find anything on this. Any help would be awesome

    TIA
    Doug

  2. mendezki
    Member
    Posted 6 years ago #

    edited:

    Urls of the images are stored in your wp_posts and wp_postmeta tables.

    I ran into this trouble too, just exported the database as a text file, using a text editor did a 'find and replace' on the urls and imported the file back in.

  3. DougJay
    Member
    Posted 6 years ago #

    So you exported the Database and then did a 'find and replace' for the urls through the entire database and changed them all?

    Then re-uploaded it.

  4. DougJay
    Member
    Posted 6 years ago #

    Got it! I will try that right now. Thanks for your fast Reply!!

    Doug

  5. moshu
    Member
    Posted 6 years ago #

    Or, you can use the Search and Replace plugin - no need to export the DB... although a backup is always due before touching it :)

  6. mendezki
    Member
    Posted 6 years ago #

    Maybe I should elaborate:

    References to your images are stored in your database, both in the wp_posts and wp_postmeta tables (in a standard install. You might have given your tables a prefix, but locating them should in any case be doable).

    Since you mentioned using phpMyAdmin I guessed you are able editing the contents of your database with this tool.

    Via phpMyAdmin you could manually locate and change the urls pointing to your images (removing the 'wp' part). But as this might be quite a few database entries, replacing all in one go is a more convenient decision.

    I myself have had satisfactory results by

    1. exporting the complete database as a .sql file through the phpMyAdmin export option.

    2. editing this file with a text editor (converting the incorrect urls to the correct ones, make a backup copy first in case anything goes wrong, never forget the backup!)

    3. deleting all database tables (for the wp install you're trying to correct)

    4. importing the edited .sql file

    Mind you, I'm not an sql hotshot so there might be a better way to go about this, heck, I probably shouldn't even be writing this : )

    EDIT:

    Sorry, I'm a slow typer lol... Thanks for the tip Moshu, next time I'll use the Search & Replace Plugin too :)

  7. DougJay
    Member
    Posted 6 years ago #

    Hey, Thanks very much. Your info was a great help.

    What I ended up doing is doing a search though my whole Database with the string that was wrong, I had to change 43 entries one by one and now I know that much more about PHPMyAdmin!

    Thanks again!
    Doug

Topic Closed

This topic has been closed to new replies.

About this Topic