Thanks for the reply. At least, it’s going to help others with a similar requirement to find the thread. And possibly a good solution, because after some research, I was able to implement a network explained in my original post.
I’m not an expert. So you should research more on each step given below before implementing them;
1- Enable wildcard subdomains for the main domain (*.example.com).
2- Enable wildcard subdomains for the sub-domain that you’re going to base your network (*.mynetwork.example.com). I’m not sure this step is necessary (you’ll see why in later steps) but I didn’t have time to experiment without it after things started working.
3- Open your wp-config.php file and add this code after the system suggested code block for the multisite: define( ‘COOKIE_DOMAIN’, ”);
So the entire multisite code block will look like this;
/* MULTISITE CODE BLOCK */
define('WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'mynetwork.example.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
/* This is required for domain mapping. */
define( 'COOKIE_DOMAIN', '');
4- Now each time when you create a new site it’ll have an URL like this: XXXX.mynetwork.example.com
But we need this to be changed as XXXX.example.com
Now simply delete the unnecessary part in the auto-generated URL to get your desired site URL. That’s it. You have to repeat this step for each new site you create.
Yes, this may not be a practical solution for some situations. And I see people are using domain mapping plugins to achieve similar results. But at the moment the above method is working for my project without a noticeable flaw. Hope I won’t encounter unexpected issues in the future, especially with WP updates.
Few resources helped me but these two were the most helpful (one is actually the answer);
https://wordpress.stackexchange.com/questions/114994/multisite-install-w-sub-domains-on-a-subdomain
https://wordpress.stackexchange.com/questions/94615/how-to-set-up-wordpress-domain-mapping-on-mamp-pro/94619#94619