post-page

WordPress FAQ: Changing Links and Images After a Move

12
responses
by
 
on
December 13th, 2010
in
WordPress, WordPress FAQs

So, you’ve just moved your WordPress blog following the official instructions, but what about all of your internal links and images?

Even though you may have changed your main URL during the move process, your internal links and images will remain unchanged, leaving images broken and internal links pointing toward the old domain or directory. Sure, you could manually edit every single post or page, but there are other ways.

The easy way is to use a plugin called Velvet Blues Update URLs. It’s a very simply plugin. You just enter your old URL, then enter your new URL, and this plugin take cares of the rest. I know, it almost seems too easy, but in this case it really is just that easy. Of course, if you want to make it a little bit more difficult, we sure can.

What if Velvet Blues Update URLs disappears and you’re left to fend for yourself? You can use the Search and Replace plugin to search for your complete old URL and replace it with your new URL. A note on searching for the complete URL, don’t take shortcuts. If you moved from maindomain.com/blog/ to maindomain.com, do not simply search for and replace all instances of /blog. This will all affect all instances of /blog, including links to other sites and blogs that may have /blog in the URL. Instead, search for maindomain.com/blog/ in its entirety and replace it with maindomain.com.

What if you can’t use plugins? What if you have an illogical need to do everything the hard way? Well, we haven’t forgotten about you. There’s a hard way to do just about anything. Simply backup your database and open the .sql file in a plain text editor. As above, search for and replace all instances of the complete old URL with the new URL. The same warning about shortcuts applies here as well. Once you’re done, save the file and restore your database.

As always, if you run into any problems, the volunteers in the WordPress Support Forums will be more than happy to help.

This is the first entry in our hopefully long-running WordPress FAQ series. What did you think, and what questions would you like us to answer next?

heading
heading
12
Responses

 

Comments

  1. Mark Ghosh (386 comments.) says:

    To get people thinking about the FAQ series, here are some common questions I receive:

    What are the best websites to find Free WordPress Themes?
    How do I safely and automatically backup my WordPress install?
    How do I download new plugins for my blog?

    All the FAQs will be linked from an FAQ page that users can be directed to from Forums and other places. We will keep the data updated to the best of our ability.

  2. Brian Charles Clark (1 comments.) says:

    This is very helpful — you mention updating images but don’t say how. Any insight on that?

    • James Huff (109 comments.) says:

      Updating the links will take care of the images as well. :)

      It’s just a matter of replacing all instances of the old domain or directory with the new domain or directory.

  3. Otto (215 comments.) says:

    Searching and replacing in the raw SQL file often does not work, because of WordPress’s use of serialized data.

    Best to use a plugin. I like the Search Regex plugin myself: http://wordpress.org/extend/plugins/search-regex/

  4. Destination Infinity (7 comments.) says:

    Why should we change the URL of images at all? Can’t it be hosted in WP.com ? I can understand about the internal links though – I actually wanted to change them manually and hence was awaiting some free time to do so! So, I guess its time to look at the plugins.

    Destination Infinity

    • James Huff (109 comments.) says:

      Sure, you could leave your images on WordPress.com, as long as you don’t delete your WordPress.com blog.

      I suppose you could say that this FAQ is geared more towards folks who want to move their blog from domain.com/wordpress/ to domain.com or from firstdomain.com to seconddomain.com.

  5. Chris Fellows (1 comments.) says:

    Well I think using a CDN through a performance plugin might be easier. Also broken links plugin works pretty good to fix these problems after a move.

  6. ddeconin (1 comments.) says:

    Hi,

    I used the plugin you mentioned to copy a wordpress site to a ‘test’ version so that I can modify the template. Unfortunately when I use export/import to copy the site and then update the urls of the images like mentioned above I still don’t see the images in the media library.
    Is there a way to populate the media library from the post content?

  7. Sunmai (1 comments.) says:

    Just awesome. This was actually the best article I found on how to fix the broken link issue on the WordPress site move. I think what kept me around was the part where you say if that was too easy, we will make it harder.

    Love the article

  8. nichive (1 comments.) says:

    I’m looking a single MySQL query that will replace a string pattern occurrence in the database, so that every given path is act accordingly to the new host.

    Anyone can help me with to solve this issue?

  9. Ahmad Taleb (1 comments.) says:

    THANK YOU!!!! Countless hours spent not being able to figure out how to fix this issue and your post just saved me from spending countless more.



Trackbacks/Pingbacks

  1. […] WordPress FAQ: Changing Links and Images After a Move
    […]

Obviously Powered by WordPress. © 2003-2013

page counter
css.php