WordPress multisite or not, when it comes to migrating WordPress from one domain to another domain, it can get very tricky. Sure, for a single install without multi-site capabilities a migration should be as simple as moving a site’s files to a new domain and adding some directives to wp-login.php as described here. But..
- What about updating links in posts?
- What about changing the domain name in custom menus and footer links?
- What about updating links in comments?
- What if the site is being moved to a subdomain or sub-directory?
There is a better way to move WordPress and update all internal links in menus, comments, posts or anywhere else. This better way works for WPMS too. It even works with serialized data; you know, serialized data, the type of data that counts string length when it’s stored in the database and is ignored if the string length is shorter or longer than its character count. Serialized data has buggered up site migrations many times for lots of web developers.
So what is this better method?
The simplest and quickest way to move a WordPress site to a new location is this:
- Copy the site’s files to the site’s new server space.
- Delete redundant data like redirection plugin logs and security plugin logs using the WordPress dashboard then use PhpMyAdmin to repair and optimize the tables.
- Export the database
- Create a new database for the site.
- Import the exported database into the new database.
- In the new site’s server space, update wp-config.php with the new database name, database username and database password. Using a new database — even if the migration is to a new subdomain, addon domain or sub-directory of the same server — stops the original database getting damaged in case it is needed again later.
- Download InterconnecIt’s Database Search and Replace script (searchreplacedb2.php).
- Upload the script to the site’s new server space.
- Unzip the script
- Browse to the script directory in your web browser
- Follow the script’s prompts.
- Delete the script.
It’s that simple! No need to edit any WordPress files or make any other changes to the site’s database.
More details about the WordPress database search and replace script can be found on Intercennect.It site, here.