• gendem

    (@gendem)


    Hi there

    I have made a few changes in my blog since upgrading to 2.5: I have changed the URL for the blog, and I have changed how permalinks will be shown.

    I now have a database containing posts with links to other posts, using the wrong url, *and* the wrong permalink structure.

    Is there an option to fix this? It would also be nice to be able to update links to my images, as they are all wrong for the same reason.

    Something like a search and replace on URLs or something? Or is there a tool/plugin to do this?

    …Mike

Viewing 4 replies - 1 through 4 (of 4 total)
  • hakre

    (@hakre)

    Hi Mike!

    Changing the Domainname:
    Yes, there is some form of “Search and Replace”.

    To update WordPress options with the new blog location, use the following SQL command:

    UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

    After that […] fix URLs of the WordPress posts and pages […] stored in database wp_posts table as guid field. […]

    UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

    And further on:

    Use the following SQL commands [sic!] to fix all internal links […]:

    UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

    Source: (ensure you got a good adblocker, some really ugly advertisements displayed there including the ones that look like those which want to trick you into malicious downloads) wxx.mydigitallife.info/2007/10/01/how-to-move-wordpress-blog-to-new-domain-or-location/

    Take a look here as well: http://codex.wordpress.org/Moving_WordPress

    Thread Starter gendem

    (@gendem)

    Thanks, that did it 🙂

    Thread Starter gendem

    (@gendem)

    OK, now that I have changed the domain information successfully, the problem remains of fixing the permalink structure to posts I link to in my own blog. Is there any way to wordpress to update permalinks to itself links within it’s own database? Or is this a search and replace type of deal as well (albeit more nightmarish?

    …Mike

    hakre

    (@hakre)

    Change the permalinks settings to the default and then change it back to your current value. this should re-build your permalinks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Updating links in old posts when things change’ is closed to new replies.