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?
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:
Steps:
You are done!
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.
A very extensive search & replace (with regex if needed) in the entire db. Yes, everything. Yes, it’s a pain.
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://
“.