How to install WordPress Multisite with different domains under the same subdirectory?

You don’t need domain mapping in current versions of WP, it’s built in.

You just need to edit the site Settings (under Network Admin, Sites, click on site then Edit). Enter the URL for the site (https://www.example.com or whatever). If you need to, use the Settings tab when editing the site and change all references to the correct domain name.

See also my answer here: WordPress multisite with different domain

Added (by request)

When creating a multisite sub-site that will have it’s own domain, I always create the site first. On the Network Admin, Sites, Add Sites screen, the URL will be https://www.example.com/subsite3 , where you enter ‘subsite3’ as the ‘site address (URL)’.

Once you have set up the site (and registered the domain name, and set the domain’s nameservers as required), then you can go into the Site Settings (Network Admin, Sites, edit the site) and change the URL on the Edit Site, Info tab to the actual domain name (https://www.newsite.com ).

I also go into the Settings tab on that screen and change the “SiteUrl” and “Home” settings if needed. And since some plugins may have your site URL (the original value you entered when creating the site), I always go through all the settings and change any URLs as needed in there.

Then, a test of all site pages (admin and actual site) to make sure they work correctly. I then configure plugins on the site as needed, then go back into the Settings tab (on the Network Admin, Site, edit screen) and make sure the new domain value is in all of the settings location.

Since WP 4.9x supports domain mapping (since 4.5?), there is no need for domain mapping plugins.