I have following situation. I have a WP Multisite installed in subdirectory:
my-domain.com/subfolder/wp-multisite-root
Now normally next sites added would be created like that
my-domain.com/subfolder/wp-multisite-root
my-domain.com/subfolder/wp-multisite-root/site1
my-domain.com/subfolder/wp-multisite-root/site2
my-domain.com/subfolder/wp-multisite-root/site3
Is there any way to have it created like this?
my-domain.com/subfolder/wp-multisite-root
my-domain.com/subfolder/site1
my-domain.com/subfolder/site2
my-domain.com/subfolder/site3
There is one more trick. my-domain.com/subfolder/ contains another non wordpress application.
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:
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’:
(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:
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 theoption_name
is ‘siteurl’ and ‘home’. It can be done by running following queries: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.
Piemol’s answer is great and worked for me. However, I was unable to log into any of my sites except the main site. Upon inspecting my cookies, I discovered WordPress was making a cookie for only my main site and not the other subdirectories. To use OP’s example, it was making a cookie for
/subfolder/wp-multisite-root
, which/subfolder/site1
could not use.I dug through WordPress core to see what I needed to fix, and I ended up adding this code to my custom plugin to fix the paths used for the cookies:
In my case, my site structure is actually like Piemol’s, so I fixed my cookie paths to be the root:
The simplest solution is to make
my-domain/subfolder/
the WordPress install directory and base URL, then enable multisite configured to use subdirectories.I’ve been trying to do a similar thing, and from everything I’ve discovered so far I think the answer is no, this isn’t currently possible 🙁