Domain Mapping multiple Subdirectory install

Here's my situation. For various reasons, we needed to set up a strange sort of network for a large organization with indvidual state-by-state multisite installations under a master domain... i.e....

There is a multi-site installation at: http://www.mydomain.org and then there are separate multi-site networks installed in each US state subdirectory... i.e. http://www.mydomain.org/nc/, http://www.mydomain.org/ny/ etc.

So I installed the domain mapping plugin on the master domain an it works just fine. i.e. northcarolina.org maps correctly to http://www.mydomain.org/northcarolina

Where I'm having a problem is getting the domain mapping to work on the subdirectory installations. For example: I want to map the domain ncsite1.org to http://www.mydomain.org/nc/site1

When I go into site1 and select domain mapping, the original blog address http://www.mydomain.org/nc/site1 shows correctly, but when I put ncsite1.org into the custom domain and click add...the resulting custom domain comes up as ncsite1.org/nc/

Naturally, I get a 404 Not Found error from the Apache server.

Am I doing something wrong or is there any way to correct/workaround this? I'd really like to offer the domain mapping to the users at the state level.

    theshu

    David,

    I'm not sure how to explain it correctly so I'll tell you the procedure and hopefully it will make sense.

    I secured the mydomain.org domain at Godaddy and pointed it to my dedicated server via nameservers. On my server (which is CentOS linux with Apache), I created an account for mydomain.org and uploaded the wordpress multisite to the root folder (public_html).

    I then created the state subfolders and uploaded a full wp multisite installation into each one... /nc/, /ny/, /wi/ etc.

    The domain mapping plugin works fine for those sites at the root directory level. It's not until I hit the subdirectories where I run into problems.

    Does that make any sense?

    DavidM

    Hiya theshu,

    Glad you caught that IP issue! And thanks for that breakdown! I was trying to get an idea for exactly how you're setting everything up.

    Now that you have those other domains pointed at your main IP, is it also possible to point them to the relevant directory within your site that they need to be routed to?

    So for instance, have the domain name ncsite1.org, point to our IP as well as the sub-directory mydomain.org/nc/ncsite1.

    Cheers,
    David

    DavidM

    Hmm, okay perhaps we should scratch that thought. I may have misunderstood what it is you're trying to achieve.

    Have you by any chance taken a look at our Multi-Domain Mapping plugin?
    https://premium.wpmudev.org/project/multi-domains

    From the looks of things, it seems that might be what you're actually trying to achieve. Could you please take a look into that and let me know if that's actually what you're looking for?

    I believe it will provide a more elegant solution in that all the sub-sites can be easily managed as super admin from one main WordPress install rather than having to have separate WordPress installs for each state.

    Cheers,
    David

    theshu

    Not sure I'm following your question.

    Now that you have those other domains pointed at your main IP, is it also possible to point them to the relevant directory within your site that they need to be routed to?

    I think that's the problem I was originally trying to solve. How do I get the domain to map to the subdirectory?

    Using my example, at Godaddy I set the A record for ncsite1.org to the dedicated ip for mydomain.org on my server. That's already in place.

    The problem is, when I type ncsite1.org in my web browser, I end up at mydomain.org instead of mydomain.org/nc/ncsite1

    I'm wondering if it's because of the location of the files which control the domain map for this subdirectory. Namely, sunrise.php is in /public_html/nc/wp-content/sunrise.php and domain-mapping.php is in public_html/nc/wp-content/mu-plugins/domain-mapping.php

    I suspect that my ncsite1.org domain is hitting the domain mapping plugin that I also have installed in their respective files in the root directory, it's not finding a matching map so it throws it back out to the main domain.

    theshu

    Sorry if things look a little out of order, you both responded while I was typing my reply to David.

    I installed the Multi-Domain in my root directory wp installation with the files in their correct directories and renamed the dm-sunrise.php as instructed. But I guess I'm at a loss as to what it will achieve.

    When I go to the plugin, it's shows my base URI mydomain.org. Just for testing purposes, I then created mydomain.org/nc as another domain. Didn't seem to make any difference.

    Unless I'm doing something wrong, I don't see how the Multi-Domain plugin is helping anything as the sites in my subdirectory installations don't fall under the installation at the root. If that makes any sense.

    Also:

    I believe it will provide a more elegant solution in that all the sub-sites can be easily managed as super admin from one main WordPress install rather than having to have separate WordPress installs for each state.

    From a super-admin standpoint I would love that. But it would be a nightmare for our state-level administrators. Not to mention that we do custom work for each individual state that would be difficult to manage from a single installation.

    Keep in mind you'll always have the directory (/nc/) in there due to your setup.

    So basically what your saying is, I can't use domain mapping for the sites in my subdirectory installs. Bummer.

    Ivan

    Hi,
    I have a similar issue with the plugin.
    I have 2 multisite networks on a shared hosting with cPanel and I am using the domain mapping plugin, the first network is a subdomain setup, installed in the main directory on the server (publik_html) and when I park a domain the domain mapping plugin works just fine. The second network is a subdirectory setup and is installed in a folder (publik_html/1/). The problem is that cPanel does not let me park a domain in a directory different than the main one (publik_html) an so the mapping plugin does not see it. I tried with addon domains because cPanel lets me choose the subdirectory (publik_html/1/) but it doesn't work either.
    Is there a workaround for solving the problem?

    Thanks in advance!

    Tyler Postle

    Hey Ivan,

    Sorry about the delay on this. It's always better to create a new thread instead of replying on someone else's really old one. Some of these old ones may not be seen for awhile after being replied on. I see you have already created a new thread and Michael is helping you out here: https://premium.wpmudev.org/forums/topic/domain-mapping-for-multisite-installed-in-a-subdirectory1-on-the-hosting-server-publik_html1#post-1041338

    Awesome I'm just going to close this one up to avoid any further confusion.

    Cheers,
    Tyler