Support » Fixing WordPress » moved my WP location; now must update addresses

  • Resolved mzimmers

    (@mzimmers)


    Hi –

    So, I finally took the plunge and moved my blog from my /wordpress subdirectory to my root directory.

    Now, I have several references in template code and in my WP Pages that are broken. It seems that my choices are to bite the bullet and edit every occurrence, or to somehow find a way to override the bloginfo tag with a local version that does what I want.

    I suppose a third version is to auto-edit, but…this isn’t possible with WP Pages, is it?

    Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)
  • MichaelH

    (@michaelh)

    Review Moving WordPress. If you fix your Settngs->General Blog and WordPress addresses then the bloginfo will take care of itself.

    Jonas Grumby

    (@ss_minnow)

    There is documentation about how to do this, but the bottom line is that you can’t just move the files without “telling” the database where your site files are.

    See this page

    Also, if you can still log into the admin at the old address, you can try going to Settings > General and make sure the correct (new) URLs are there. If the old ones are still there, change them. After that your site should only work at the new URL and will no longer work at the old URL. If you find that to be true, you can delete all of the files from the old folder.

    You also have to go into Settings > Miscellaneous and take the old folder name out of the image upload path, you have to take the folder name out of the .htaccess file in the main WP directory, and you have to check any plugins that save files (like XML sitemap) to make sure the path is correct there.

    It sounds like you moved the files but did get the new URLs into the database, and perhaps have a .htaccess issue.

    Thread Starter mzimmers

    (@mzimmers)

    Thanks, Michael. I guess I should have been more specific. I have lots of Pages with code like this:
    <?php $imagepath = get_bloginfo('url') . "/wp-content/uploads/reviews/range/ctk"; ?>

    Then later in the Page, I append a file name to that path. This was the correct path when my blog was under the wordpress directory, but now, I believe I need to change all occurrences of ‘url’ to ‘wpurl.’ If there’s a better way to do it, I’m keen to learn it.

    So, is there a way to auto-edit the Pages? I’m really reluctant to try to tweak the DB directly, but I’ll do it if someone can provide instructions.

    Thanks.

    Jonas Grumby

    (@ss_minnow)

    Michael certainly knows more than I do, but your php code says that your image is in a folder off of the root called /wp-content/uploads/reviews/range/ctk

    If that’s not the correct path to your images, you’ll have a bunch of broken images.

    It seems like you are referring to this code being in your php template files. If that is the case, there are lots of HTML editors that can do “Advanced Search & Replace” for criteria like “all open files” or “all files in the folder”. If you have to update your template files you can do them all simultaneously. If you need to do something similar with your content, there is a plugin called Search and Replace.

    Jonas Grumby

    (@ss_minnow)

    p.s. be careful w/ Search and Replace and always make backups before you make changes.

    Jonas Grumby

    (@ss_minnow)

    And BTW another option rather than editing the code is to upload the images to the folder where the code says they are.

    Thread Starter mzimmers

    (@mzimmers)

    My theme files are no big deal; after a closer look there were only a couple of places where this change needed to be made.

    It’s the Pages within the WP database that’s going to take a little time. That’s why I was hoping for a somewhat automated approach, but…I guess I’ll just plow through them.

    Jonas Grumby

    (@ss_minnow)

    You can use the Search and Replace plugin to update content in the database. The plugin searches for raw text, so it can replace code strings as well as page text.

    Jonas Grumby

    (@ss_minnow)

    Just for fun you should back up your database with a plugin like WP-DBManager before using Search and Replace.

    Thread Starter mzimmers

    (@mzimmers)

    I wasn’t aware of that plugin. Thanks for the reference.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘moved my WP location; now must update addresses’ is closed to new replies.