There may be a variety of reasons for having to do this, despite how daunting it may seem, it’s actually not that big of a deal.
If we want to change oldnetworkname.com
to newname.com
on a domain mapped WordPress Network, we just have to modify a few settings in WordPress, all records manually in the database, and then write a rewrite for external links pointing to the old domain.
wp-config.php
Change the network domain name in wp-config.php
:
PHP MyAdmin
There’s a few options here – it depends on the scale of your network, and how many plugins your networks site use that store information in serialized strings.
The main* records that will allow your network domain change are:
However beyond that, you will need to modify all instances of oldnetworkname.com
in the database because when you change the main mapped domain, your domain mapping plugin will not modify the hard-coded urls anymore (i.e., in TinyMCE if you add a link, the link will be oldnetworkname.com/sitename/linkpage
, on the front end, the domain mapper will change oldnetworkname.com/sitename
to site
name.com
). When switching primary domains, the detection of the old network url is lost, and must be fixed).
So instead of modify records individually, I’d recommend exporting the entire database, doing a find+replace of the domains (don’t bother with http://
or trailing /
, as some records don’t include this, keep it simple, just the domain names) with a text editor, wipe the remote database, then importing the altered .sql file.
Note: I mentioned serialized strings because they may break when doing the find+replace because the string length of the domains. Please take extra care into making sure things like widgets are preserved.
.htaccess
For anything external, write a redirect in your .htaccess file. The 301 will fix these links overtime for indexing on Google etc.
Longevity
I recommend holding onto the old domain as long as possible (to preserve these external urls, maintaining SEO ratings).