How to Move a Website from a WordPress Multisite Network to Its Own Standalone Site
WordPress offers the very powerful Multisite Network feature, which makes it possible to run multiple websites on one single WordPress installation. But there may come a point in time when you need to move a website out from a network to its own standalone site, for instance, when migrating a networked site to a different server. Some people may be put off by this process as it seems impossible to change the configuration. I had to do this recently, and successfully migrated a site out of the network onto its own standalone WordPress installation with its own database.
The process is a technical one, but not that complex. Just remember to backup your database so that you can easily restore it if something goes wrong. Here are the steps I took.
Moving a WordPress site from Multisite Network to Standalone Installation
On the old server/database:
- In phpMyAdmin (or whichever SQL client you are using), export all tables used by the site as an SQL file. Minimally this should comprise the following:
– Tables with the prefix of wp_#_* (where # is the number corresponding to the site you are moving). If your site is housed in tables wp_2_*, you should be exporting these tables only.
- Open the exported SQL file in a text editor.
- Find and replace all instances of wp_x_ with wp_ .
- Find and replace all instances of /files/ with /wp-content/uploads/.
- Save the file. Your edited SQL file now has the necessary tables for a standalone WordPress site.
- In a FTP client, download all the Media files that have been uploaded to the site. These files reside in the folder wp-content/blogs.dir/#/files (where # is the number corresponding to the site you are moving).
You should now have the edited SQL file and the Media files. We will need to move these to the new server.
On the new server/database:
- Run a fresh installation of WordPress. You should have a brand new, working WordPress site with the “Hello World” blog post.
- In phpMyAdmin, import the SQL file you have earlier edited. This will import all the WordPress content from your previous site.
- Run this SQL query:
UPDATE wp_posts SET post_content = REPLACE(post_content, '/files/', '/wp-content/uploads/');
- If you have changed your URL, run this SQL query:
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://olddomain.com', 'http://newdomain.com');
- Browse the wp_options table.
- Under the field option_name, scroll down and look for upload_path. Change the option_value from wp-content/blogs.dir/#/files to wp-content/uploads.
- Under the field option_name, scroll down and look for fileupload_url. Change the option_value from http://olddomain.com/files to http://newdomain.com/wp-content/uploads.
- If you have changed your URL, under the field option_name, scroll down and look for siteurl. Change the option_value from your old URL to the new URL.
- In a FTP client, upload all the Media files to wp-content/uploads folder.
You should now have your site running on its own WordPress installation, with all the content and files from the formerly networked site.
While these steps are taken to move a site from server to server, they will similarly work for moving a site from one database to another within the same server.