Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

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

How do I do that?

share|improve this question
add comment

4 Answers

A very extensive search & replace (with regex if needed) in the entire db. Yes, everything. Yes, it's a pain.

share|improve this answer
    
Thanks andrea, any post that will suggest a few regex to do such thing. I am not very verse in sql queries, and I have no idea how to query a full database with one query. –  Geo Feb 27 '11 at 20:38
add comment
up vote 1 down vote accepted

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!

share|improve this answer
add comment

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://".

share|improve this answer
add comment

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: http://interconnectit.com/124/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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.