Migrate WP 3.0 from subdomain to another subdomain (20 posts)

  1. jonnylons
    Posted 5 years ago #

    Ok, here is the situation.

    I am sharing hosting with my sites. My main site is set up and hosting all my other domains. I have each of these domains pointed to a subdirectory on the main site. For example:

    mainsite.com is hosting mainsite.com/domainA, mainsite.com/domainB, etc.

    I have a domain that was pointing to mainsite.com/domainA which had WordPress on it. I want to shift that domain to point to mainsite.com/domainB, which also has WordPress installed on it but WP 3.0.1 (using the multisite functionality and buddypress).

    So, I went into my host, pointed the domain to mainsite.com/domainB and indeed, when you type in the domain name it redirects to mainsite.com/domainB.

    Problem is, I don't want my URL to reveal where I am hosting my site to visitors. I don't want the url to say mainsite.com/domainB. I want the URL to say domain.com.

    With the old WordPress, or even the current standard install (not multisite), you would just go to Admin > Settings > General and change the URLs of the WordPress URL and Site URLs. (as per our example, I just changed it from mainsite.com/domainA to domain.com)

    You can't do this in WP 3.0 multisite. I am trying to figure out how. Now, when I look at the wp-config.php file I see:

    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/domainA/';
    define( 'DOMAIN_CURRENT_SITE', 'mainsite.com' );
    define( 'PATH_CURRENT_SITE', '/domainA/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    Is that what I need to change? Just change mainsite.com to domain.com and domainA to domainB?

    Thanks to anyone who can help!

  2. And all the references that are saved in the database.

  3. jonnylons
    Posted 5 years ago #

    Thanks Andrea, but that didn't seem to work.

    I updated the links in the wp-config file but I am still getting the same URL:


    Maybe I didn't mention this - I have my domain pointing to my directory. I want the URL to not state exactly where it is, but have the domain name there instead. So, instead of mainsite.com/domainB (as it was moved from mainsite.com/domainA), I want it to simply say domain.com.

    I have pointed the domain to mainsite.com/domainB. I assume that there is something I have to configure in the config file for that to change but the suggestion I made above didn't work.

  4. jonnylons
    Posted 5 years ago #

    Ok, long story short:

    Figured I would use the Super Admin > Sites > Edit function. But it wont let you change the Domain, Path, and SiteURLS.

    Are those the areas that are changed in the wp-config file?

    @ Andrea-r, you mentioned updating the references in the database. How is that done?

  5. You go into the databse via something like phpmyadmin and you do a search for all instances of the old URL. then you updated to the new one.

    It's laborious.

    You can get a backup or dump of the db, edit it locally to do a sweeping search & replace, then put it back on the site.

    When you are running a network you can't just change it in the config file, because it is stored in most of the tables in the db.

  6. jonnylons
    Posted 5 years ago #

    Ahh...ok, good to know.

    So, how do you install the site then? If I create a directory and upload wordpress 3.0, how do I get the domain to reflect the directory?

    Put it another way, if I wanted mysite.com/blog to be the root, how would I point the domain to be domain.com = mysite.com/blog?

  7. You'd install wp in the directory you want, and it'll pick that up.

    then up in the root, you'd put in a redirect (outside of wp)

  8. jonnylons
    Posted 5 years ago #

    I am still not finding the solution. But let me be specific here, what the heck.

    I want domain MarlinsNation.com to point to the sub-directory phrenes.com/marlinsnation-site I have my domain pointed towards that directory with my host, no problem. But when I navigate to my site, it still shows the url phrenes.com/marlinsnation-site, etc. I want that to change to marlinsnation.com/...

    So, here is what I have done so far.

    1. I have updated my config file from:

    $base = '/marlinsnation-site/';
    define( 'DOMAIN_CURRENT_SITE', 'phrenes.com' );
    define( 'PATH_CURRENT_SITE', '/marlinsnation-site/' );


    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'marlinsnation.com' );
    define( 'PATH_CURRENT_SITE', '/' );

    2. I changed my htaccess from

    RewriteBase /marlinsnation-site/


    RewriteBase /

    3. I went into my db, using phpmyadmin, and updated the following fields on the table wp-options:


    From ...phrenes.com/marlinsnation-site
    To ...marlinsnation.com


    From ...phrenes.com/marlinsnation-site
    To ...marlinsnation.com

    (... = http://) I got a database error.

    Ok, I hope someone spots something really obvious because, for the life of me, I can't figure this one out. Driving me MaDD ;D

  9. re #3 - there's more tables. I'd list them, but... there's a lot. Like
    for starters.

  10. jonnylons
    Posted 5 years ago #

    Thanks Andrea.

    I create a data dump from my tables, copied and pasted to Notepad. Then used the search function to find the old URL and replaced it with the new URL. You're right, it was laborious, especially on a site that extends back a few years with content, but using that technique was efficient.

    Now, here is a really dumb question. How do I save that work as an .sql so I can import it back into my database? And, do I just import it or do I have to drop the tables first then import it?

    After this, I will make the edits mentioned above to my config and .htaccess files. That, I hope, should do it.

  11. jonnylons
    Posted 5 years ago #

    To save my revised data, I just clicked Save As in Notepad, and chose UTF-8 for the option and titled the file datafile.sql. Saved it - just hope all the characters stay!

    According to this article, they will:


    Now...how to import back into database...

  12. Yeah, this is the scary part - you have to drop all the tables and reimport your new sql.

    For the nervous - dump it all in a new db and switch the config to use the new db.

  13. jonnylons
    Posted 5 years ago #

    dropped my previous tables, and imported new data.

    Configured my config and my htaccess files and...

    Error establishing database connection

    So, it didn't work. I am sure I missed something but getting frustrated since this is seemingly something that isn't all that complicated and has been done before. After all, how do people migrate their WP installs from one directory to another?

  14. jonnylons
    Posted 5 years ago #

    You win, for now, WordPress. But I'll be back someday!

    In all seriousness, I have a production site and can't afford to mess around with it. I will try this out on an experimental site and see exactly how you migrate WP 3.0.1 MS from one sub-directory to another and point that domain there.

    If I can't figure it out, I am sure someone else will!

    Thanks for your help. Andrea. Sorry I am too stoopid to figure out how to fix this!

  15. Configured my config and my htaccess files and...

    Error establishing database connection

    Could been a typo. :) Been there.

  16. halles
    Posted 5 years ago #

    Check your wp_blogs table and check the domain names for your blogs... it seems that wp looks for a "available" blog, and if not, it raises that database connection error :)

    I had the same issue just now.

  17. omnadren
    Posted 5 years ago #

  18. zombiedoctor
    Posted 5 years ago #

    @halles Thank you, thank you, thank you! I lost about 5 hrs of sleep trying to figure this out. Hopefully my experience helps others avoid some aggravation.

    I followed WordPress.org's directions without any luck. It's not complete and parts are totally wrong for 3.0 multisite. The General Tab does not have a URL box you can change, so I had to go into phyMyAdmin and manually find all instances of my old install (/dev/.. i wanted it moved to root).

    Moved files to root, changed DB. Site switched over, but couldn't login. Wrong passwords yielded the usual No-No shake, but correct passwords just sent me back to the admin login page in an endless loop. Editing wp-config.php define( 'PATH_CURRENT_SITE', '/' ); caused a database connection error. I then tried messing with .htaccess and mod_rewrite directives w/o success.

    I didn't think to look in wp_blogs. I zapped my old 'dev' from the following tables, changing it to '/':

    wp_site (field: path)
    wp_options (field: siteurl, home)

    then in .htaccess, I changed
    RewriteBase '/dev/' to RewriteBase /

    Wow... all that.. and only my main site is restored. Networked sites still need working.

  19. zombiedoctor
    Posted 5 years ago #

    Update: ok, finally figuring this all out.
    i need to keep RewriteBase /

    Then Wp admin lets me change their siteurls. If this is locked for you, you'll need to go into phpMyAdmin and edit the table for each blog, ex:

    wp_3_options is the options table for my 3rd blog. Change siteurl to the new path.

  20. I followed WordPress.org's directions without any luck. It's not complete and parts are totally wrong for 3.0 multisite. The General Tab does not have a URL box you can change, so I had to go into phyMyAdmin and manually find all instances of my old install (/dev/.. i wanted it moved to root).

    If you;re talking about a codex entry, you should point out which one. Likely it was written for single installs.

    You are free to edit or add to the codex as a member, anyone can.

Topic Closed

This topic has been closed to new replies.

About this Topic