Help migrating WPMS from subdirectory to root

I developed a WP MS project for a client. During development it was in http://www.domain.com/staging/ now that the project is ready to launch I'm trying to migrate it to http://www.domain.com/ but I'm having a heck of time. If I edit the $path_to_current_blog in wp-config.php from '/staging/' to anything else I get a "can't connect to database message. I've tried editing the wp_blogs table all to no avail.

Anyone have any advice?

Thanks,
Colin

  • Timothy Bowers

    Well to start with I would take a peek through the following:

    http://codex.wordpress.org/Create_A_Network

    Note the difference in htaccess and wp-config.php

    I would also take a dump of the DB and run a quick find and replace on it, changing any relevant and hard coded content/links.

    You should then be set to go.

    One of the most important things here is, backup, backup, backup! :slight_smile:
    Then if you get it wrong or something happens, you have something to fall back on. :slight_smile:

    Take care.

  • colind

    Thanks for the pointers. I've used iTheme's Backupbuddy which has a clever little DB tool called RepairBuddy which makes it easy to do per-table and whole db find/replace.

    Yes, I'm familiar with the codex article. Just to clarify, the site was built as a subdirectory-style site (www.domain.com/staging/blog-1/, http://www.domain.com/staging/blog-2, etc) So all I'm trying to do is shift the install up one level.

    Yes, I did need to edit .htaccess for the moved site; that doesn't seem to be the issue. There's definitely something going on with wp-config but there are only a few lines that are different from a standard WP install and only those two globals, $base and $path_to_current_blog that seem to be specific.

    I'm looking for some insight into how those to globals are used. For example, there's the wp_sites table that holds the list of blogs in the network. That has some /staging/ strings in it. Replacing that with / breaks it.

    BTW: I've got everything very safely backed up and have set up a local dev environment for testing (MAMP configured to operate on port 80 with virtual hosts set up so I can have multiple web roots to try different configs)

    Thanks again for the pointers.

  • colind

    I'm still trying to find any MS ninjas that can help me figure out where to look. I have a sneaking suspicion that the database connection error is slightly erroneous; the DB connection parameters in wp-config are correct: a script should be able to use those settings to connect to the database. However, the problem seems to be that once connected to the db its trying to connect to the correct set of blog tables and can't seem to do that.

    I'm a little lost about where to look next in how a MS install of WP connects to the DB and figures out what tables to use. I'm sort of guessing that the wp_sites table needs to match up with the $path_to_current_blog But I think I set that right but maybe there's some steps after that so the scripts can correctly use the blog_0 tables.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.