How to change the main site url on a multisite installation (network)?

My multisite (network) installation has 3 sites.

  • the main site (nothing there, just very brief information)
  • client 1 site — siteurl/client1
  • client 2 site — siteurl/client2

With domain mapper, siteurl/client# changed to clientdomain.com.

Read More

Up to that point all is good. Now I want to change siteurl to mydomain.com

How do I do that?

Related posts

Leave a Reply

4 comments

  1. For those of you without the required sql knowledge. The steps below can be used to change your main site url variable on a network installation.

    Assumption:

    • Windows Operating system
    • MySQL Admin basic tasks
    • WinGrep

    Steps:

    1. Download mysql dump.sql of your full wordpress database
    2. While using wingrep find all matches for @url then replace with @newURL
    3. Upload the dump file with the new variables replaced
    4. Change your wp_config.php file to the newURL

    You are done!

  2. I can’t add comments due to lack of rep, so I’ll make it an answer..

    My understanding is that the answers above will not work (or may lead to other problems down the road). That’s because WordPress has a terribly annoying tendency to store data (including site URLs) in PHP serialized arrays stored in single database fields. PHP relies on the string length of each piece of data to be able to read it properly, so if you don’t update the string lengths as well, you might run into issues.

    There are numerous scripts and tools for helping you update your database correctly. As a programmer type, I am partial to this one: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

    But I’m sure there are (much) user-friendlier versions out there.

    Having said all of that, I will confess that I’ve moved WP sites before using a method similar to that described by Geo above, and I don’t know that I’ve run into any issues yet. I just prefer not to take any chances with my site’s data.

  3. When searching for old URLs to replace, use the Search & Replace Plugin. If you select the “All – only search!” check box, you can use it to do a read-only search of all tables (even ones that it won’t allow you to select for replace) for your old domain.

    Make sure to search not only for the address, “http://<old_domain>“, but also for just the domain, “<old_domain>“, since some of the database columns will contain the domain without the “http://“.