How can I map the primary domain for subsite as subdirectory for another domain?

If you’re trying to achieve:

  • installdomain.com
  • sub.installdomain.com
  • sub.installdomain.com/sub2

OR

  • installdomain.com
  • installdomain.com/sub/
  • installdomain.com/sub/sub2

You’re describing a Network of Networks.

InstallDomain is a network (aka multisite), and has a site named Sub.
The site Sub is also a network.
The Sub network has a site named Sub2.

There are a lot of things to take into consideration, but it is definitely doable. However, I DO NOT think you can do a subdirectory second-layer network with subdomains; i.e.:

  • installdomain.com
  • installdomain.com/sub/
  • sub2.installdomain.com/sub/

I’ll try to add enough relevant links to get you in the right direction.
A good (a decently recent) introduction:

WPMU DEV article on Create a Network of Networks from Dec 2016


This repo is a good way to bounce through some code. Especially the opening cookie related stuff that’s often overlooked.

Github Repo for Wp_Multi_Network, last updated May 2017


Another angle on it:

Creating Nested SubFolders with Sunrise.php from Oct 2013


In case you prefer the talk-in-front-of-a-whiteboard option:

A 2014 WordCamp Chicago Talk on Multi-Site and Multi-Network by John James Jacoby: 50+mins