I have a project that I am working on where I wanted to be able to nest one multisite network within the other on a single domain and using a single install of WordPress.
- domain.com (Site 1, Blog 1)
- domain.com/blog1 (Site 1, Blog 2)
- domain.com/blog2 (Site 1, Blog 3)
- domain.com/network1 (Site 2, Blog 4)
- domain.com/network1/blog1 (Site 2, Blog 5)
- domain.com/network1/blog2 (Site 2, Blog 6)
- domain.com/just/showing/that/this/works (Site 3, Blog 7)
- domain.com/just/showing/that/this/works/blog1 (Site 3, Blog 8)
Note: In case you are new to WordPress Multisite, the terminology is a little confusing. In the list above, “site” refers to a network, and “blog” refers to an individual site on the network. Site and blog correspond to the appropriate tables and functions in core.
You may be wondering why even try something like this. The reason I started down this road is that it will allow me to leverage the single user base of WordPress Multisite, however, segment functionality by network activating specific plugins on specific networks. It could also be used for organizational purposes in a large implementation.
To test out the code below:
- Setup WordPress Multisite using sub-directories.
- Install the WP Multi Network plugin from the plugin repository (following included installation instructions).
- Replace the contents of the .htaccess file you updated when setting up multisite with the code below. There are only 3 small changes that allow for sub-directories more than one level deep to work properly.
- Create the file sunrise.php in the wp-content folder and place the code below within.
- Add the following line to your wp-config.php file.
Please let me know what you think and if you have any suggestion for improving the code! Thank you!