How to move a WordPress Multisite from local to Web Server

How to move a WordPress Multisite from local to Web Server.

Recently I am working on WordPress Mu (multi site). I install wordpress set up on my local server (xampp) and enables the multi site option from wp-config file by adding the following code.

[php]

define(‘WP_ALLOW_MULTISITE’, true);

define(‘MULTISITE’, true);

define(‘SUBDOMAIN_INSTALL’, false);

define(‘DOMAIN_CURRENT_SITE’, ‘192.168.0.11’); // replace 192.168.1.11 by you domain name

define(‘SITE_ID_CURRENT_SITE’, 1);

define(‘BLOG_ID_CURRENT_SITE’, 1);

[/php]

After that we need to move the developed MU site on the web server. To move MU site from local to web server we need to follow some steps.

1- First of all upload the site zip file on the server and the extract all the files the server.
2- Export the database sql from local nad then upload it on the server.
3- Edit your wp-config file, change the database connection credentials i.e. database username, password and its name. And change the MU options. Replace your domain name.
[php]

define(‘DOMAIN_CURRENT_SITE’, ‘domainname.com’); // replace domainname.com by you domain name do not use http:// before domain name

[/php]

After the above steps you need to make some changes in the database of the site.

1- In ‘wp_options’ updated the ‘siteurl’ and ‘home’ fields with your domain name
2- In ‘wp_blogs’ all of the paths were updated with your domain name (only the ones that had the localhost in them to begin with)
3- In ‘wp_site’ changed the domain and path to reflect.
4- In ‘wp_sitemeta’ updated the ‘siteurl’.
5- Update all the sub site options table. (e.g. wp_1_options, wp_2_options, wp_3_options etc.)

Make sure all of the content points to your domain name not your localserver path. To ensure about this exceute the bewlow queries

[php]

UPDATE wp_posts SET post_content=REPLACE(post_content, ‘http://192.168.0.11’, ‘http://domainname.com’)

UPDATE wp_posts SET guid=REPLACE(guid, ‘http://192.168.0.11’, ‘http://domainname.com’)

[/php]

Author: Dheeraj Dhawan

I'm a web developer / PHP programmer. I am also working on custom plugin development of wordpress.

One thought on “How to move a WordPress Multisite from local to Web Server”

Leave a Reply

Your email address will not be published. Required fields are marked *