Switch to Multisite on Local?

I have an existing site on Local. Is it possible to switch it to a Multisite by simply editing the config.php, or do I have to create a new site in Local and go through the full Multisite setup?

If so, is there a way to import the single site as a subsite?

1 Like

Just looking for a quick reply from anyone who might know the answer to this? Thanks.

Hi @ViscoDesign,

If youā€™re running the Preferred environment, see my post here: Multisite Migration Live to Local

Otherwise, if youā€™re running the Custom environment with nginx, you can do the following:

  1. Create a fresh site Custom site with the type of multisite you wish to use
  2. Go into the fresh siteā€™s /conf/nginx/do-not-modify folder and copy the wordpress-ms-sub[dir or domain].conf file somewhere safe.
  3. Go back to the existing site you wish to convert to multisite and remove /conf/nginx/do-not-modify/wordpress.conf and copy in the config file for multisite
  4. Restart the site

We have plans to improve this process. Sorry for the extra work!

1 Like

Thanks Clay. I had seen that post in my research, but my project was slightly different in that I was only working with a Local siteā€”no live site to migrate. Plus I figured there might be an easier way.

So I actually went ahead and did some testing. One approach I tried was to simply add define( 'WP_ALLOW_MULTISITE', true ); to wp-config.php in the existing site.

That seemed to work fine. It allowed me to go through the regular Network Setup within WP Admin. Once I did that, Local recognized the MS install and I could click Sync multi-site domains to hosts file. I didnā€™t even need to restart the siteā€”I just had to click away to another site and then back onto the site in question and Local recognized the new multi-site network.

Everything is working great after 24 hours, and some heavy development.

Note: this was performed on a custom environment: Apache, PHP 7.1.4, MySQL 5.6.34

3 Likes

Hey @ViscoDesign ā€“

Thatā€™s good to know! Iā€™m still learning a lot about Multisite, but as far as I understand, going from single to Multi is fairly easy, as you describe. Itā€™s trying to go back/extract a site that has pain points.

ā€“ Ben

I also try it and itā€™s working awesome thanks ViscoDesign

This didnā€™t work for me. I wonder if thatā€™s because Iā€™m using Wordpress 5.2?

  1. Adding

define( ā€˜WP_ALLOW_MULTISITEā€™, true );

has no effect.

  1. Inserting the entire script

define( ā€˜WP_ALLOW_MULTISITEā€™, true );
define( ā€˜MULTISITEā€™, true );
define( ā€˜SUBDOMAIN_INSTALLā€™, true );
$base = ā€˜/ā€™;
define( ā€˜DOMAIN_CURRENT_SITEā€™, ā€˜ngixntest.localā€™ );
define( ā€˜PATH_CURRENT_SITEā€™, ā€˜/ā€™ );
define( ā€˜SITE_ID_CURRENT_SITEā€™, 1 );
define( ā€˜BLOG_ID_CURRENT_SITEā€™, 1 );

generates the error:

This site canā€™t be reached

ngixntest.local ā€™s server IP address could not be found.

Try:

ERR_NAME_NOT_RESOLVED

Hi Clay,

Can you update the instructions to the current version of flywheel using Wordpress 5.2? I did not find a directionr called ā€œdo-not-modifyā€

Thanks

1 Like

Hey @clay,

Also how is it possible in a Custom Environment of Apache? When I create a new site (using subdomain) and then navigate to it I just get a ERR_NAME_NOT_RESOLVED warning:

This site canā€™t be reached sub.domain.local ā€™s server IP address could not be found.

Thanks in advance

1 Like

In Local 5.x, if you can edit the sites.json file in:

~/Library/Application\ Support/Local/sites.json

That file holds all the settings for all the sites. You need to find the site you are looking for. You can search for the directory name: site-name, and then after that find the multiSite setting. Something like "multiSite":null or "multiSite":"". Change that setting to "multiSite":"ms-subdomain". That will be a subdomain set up.

7 Likes

@jake Thank you! This is quite faster then reimporting as multisite!

1 Like

Just wanted to add that for Local Lightning + multisite subdirectories, the sites.json setting/value is "multiSite":"ms-subdir".

I exported a multisite Local by Flywheel backup and imported it into Lightning, but for some reason Lightning did not detect that it was a multisite setup which caused me to get a ā€œtoo many redirectsā€ error. Manually editing sites.json fixed the issue.

1 Like

ms-subdir for a subdirectory setup. ms-subdomain for a subdomain setup.

2 Likes