Support » Fixing WordPress » Moved site successfully but images still linked to old host

  • Hi all,

    I successfully moved my site and changed the domain name (phpMyadmin>>wp-options>>’siteurl’ and ‘home’).

    However, you can see that images on the new host are linking back to the old host. On both site, the image links are the same.
    My old host: http://englishacker.com/
    My new host (free): http://wclass.ecvps.net/

    So how can I change (quickly) so that the links points to the new host?

    ps: The reason I moved: I have my site on Siteground and it has been good. My hosting is expiring and their renew price is high so I want to switch to a free host at the moment (as I’m just starting and am not very serious).

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    The settings URLs only changes where WordPress loads and looks for its files, it doesn’t affect media files already in your published content.

    Use the Better Search Replace or Velvet Blues Update URLs plugins if you can access your Dashboard, WP-CLI’s search-replace if your hosting provider (or you) have installed WP-CLI, or manually run a query on your SQL database (after backing up, of course).

    Thread Starter will13877

    (@will13877)

    Thank you for the great info.

    I don’t have much knowledge about SQL query. May I ask what exactly the query will be? (I don’t want to use a plugin)

    * note: Edit ‘pref’ (three places) to correct table_prefix and change ‘http://www.olddomain.com’ and ‘http://www.newdomain.com’ as required (three places each and with no trailing slashes)

    UPDATE pref_options SET option_value = replace(option_value, 'http://www.olddomain.com', 'http://www.newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
    UPDATE pref_posts SET guid = replace(guid, 'http://www.olddomain.com', 'http://www.newdomain.com');
    UPDATE pref_posts SET post_content = replace(post_content, 'http://www.olddomain.com', 'http://www.newdomain.com');

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Or, use one of the two plugins. 😉

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Moved site successfully but images still linked to old host’ is closed to new replies.