After these years I hope this will still answer your question…
I think I’ve got the situation working you want.
Allthough I don’t have the WordPress installation in ‘/subfolder/’, but I’ve a installation ‘in subdirectory’ per language, and on the same level:
my-domain.com/nl/ -> this is primary installation, site id = 1
my-domain.com/en/ -> this is the first site created by multistie, site id = 2
my-domain.com/de/ -> this is the second site created by multistie, site id = 3
It requires a bit ‘hacking’ in the database, but it’s very easy.
Step 1:
Make sure your multisite ‘root’ installation is working as intended in it’s subdirectory. In my case I got the following in ‘wp-config.php’:
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false); // allow sub-directory install (true for subdomain install)
define('DOMAIN_CURRENT_SITE', 'my-domain.com/subfolder');
define('PATH_CURRENT_SITE', '/wp-multisite-root/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
(well in reality I don’t have ‘/subfolder’ 🙂 )
Step 2:
Now create you’re first new site through multisite in a subfolder.
When entering the foldername ‘site2’, WordPress tells you it will be created as:
my-domain.com/subfolder/wp-multisite-root/site2
That’s correct, we will remove the ‘wp-multisite-root’ folder manually t
Step 3:
Open up phpMyAdmin/directAdmin
In the table wp_blogs
edit the entry of you’re newly created site.
We will have to modify the path
of it.
It can be done with the following query:
UPDATE `wp_blogs` SET `path` = '/site2/' WHERE `wp_blogs`.`path` = '/wp-multisite-root/site2/';
Change domain name and site name accordingly.
Also look for the site id mentioned there. If its the first extra site created it will be ID 2 as in my intro.
Step 4:
Look into the table wp_<SITEID>_options
.
In our case with Site ID 2, it will be wp_2_options
.
There we will have to change the option_value
where the option_name
is ‘siteurl’ and ‘home’. It can be done by running following queries:
UPDATE `wp_2_options` SET `option_value` = 'my-domain.com/subfolder/site2/' WHERE `option_name` = 'siteurl';
UPDATE `wp_2_options` SET `option_value` = 'my-domain.com/subfolder/site2/' WHERE `option_name` = 'home';
Again, change the domain and folder name accordingly.
You’ll note that we remove ‘wp-multisite-root’ from the url there, so site2 will be on the same level as `wp-multisite-root’.
Step 5:
Refresh wp-admin and your site(s) will be listed as you wanted.