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.

For example:

  • 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:

  1. Setup WordPress Multisite using sub-directories.
  2. Install the WP Multi Network plugin from the plugin repository (following included installation instructions).
  3. 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.
  4. Create the file sunrise.php in the wp-content folder and place the code below within.
  5. 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!

2 thoughts on “Nested Networks Using WordPress Multisite and WP Multi Network”

  1. Hi, Josh. This approach is perfect for a large-scale WordPress rollout I’m working on. Have a few questions I’m hoping you might be able to assist with.

    In my tests, the WP Multi Network plugin seems to work flawlessly. However, the sunrise implementation is giving me some trouble.

    1) If I use your .htaccess as provided, I receive and internal server error, although changing +? to + in the three RewriteRule lines that use it fixes that issue.

    2) When I activate sunrise.php in the config file, I suddenly lose all network admin access and am greeted with a generic “Sorry, you are not allowed to access this page” message. I can still log into individual sites, though.

    3) With debugging on, the following problems are noted: “Notice: Undefined variable: blod in /var/www/public/wp-content/sunrise.php on line 24” and “Notice: Trying to get property of non-object in /var/www/public/wp-content/sunrise.php on line 24.” I tried resolving them by changing blod to blog and id to blog_id, but still have the problem from #2 above.

    Would really appreciate any help or insight you can provide as to these issues. Thanks much!

  2. I haven’t played with this much since I tested it last year. The project I was working on it for went by the wayside… I will see if I can find some time this weekend to check out the issues you are seeing. From what I recall, it was working fine. But it has also be a while.

Leave a reply

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