Domain Mapping for Entire Multisite Network

I have a project where I need the original URL for a multisite network to be network.example.com. This is because I have a wildcard SSL for example.com and want all logins and admin to use that domain as well as the site needs to be up and running and operational prior to the customer moving their domain to the network.

There will be sub-sites such as network.example.com/site1, network.example.com/site2, etc.

I need to map a domain to the network, so that the primary site and all sub-sites use the mapped domain for the front end of the website. For example...

domain.com > network.example.com
domain.com/site1 > network.example.com/site1
domain.com/site2 > network.example.com/site2

I am not having any luck finding a solution to this so far. At this point I think I am going to be writing my own plugin and sunrise.php to make it happen. But I wanted to put this out there and see if anyone has any other suggestions before I go that route.

Thanks!

  • alex

    Hey Joshua,

    This may help. It's how I fixed a similar issue. I don't know what hosting you're running so don't know how valid this is, but it's worth at least saying.

    Contact your hosting company and have them set your hosting account's primary domain to network.example.com instead of example.com

    Because you have already setup WPMU, your install should be fine. Like Predrag said;

    You won't be able to map a domain to the main site, only subsites can be mapped domains.
    but you'll have got around this because you're running network.example.com which can be mapped.

    Wherever you installed WPMU, in public_html or public_html/example.com make sure that your subdomain wildcard is pointing to the correct directory. If you're just using network.example.com and /site1 and /site2 then I don't see why you would need a subdomain wildcard, but anyways.

    Use the Domain Mapping plugin to map domain.com to network.example.com

    When you do this all the /site1 and /site2 redirects should fall in place automatically. If not, you might need to put in a mod_rewrite into your htaccess file to pass through the requests.

    As far as I'm aware, the Domain Mapping plugin cannot map domains to subdirectory sites, so you can't have alternatewww.com mapped to network.example.com/site1 but from my understanding you aren't trying to do that.

    domain.com > network.example.com is easy

    domain.com/site1 > network.example.com/site1
    domain.com/site2 > network.example.com/site2
    should automagically happen.

    Having network.example.com as the primary domain on your hosting server and therefor residing in /public_html/ should be conducive to this. If its dug down in a sub-directory I think it will be more difficult.

    example.com actually becomes an addon domain to network.example.com and just setup a DNS CNAME to take care of that. Otherwise, htaccess...

    That should work. Note: You will need to have a dedicated IP address and if you are on shared hosting you must ensure that your IP resolves to your site and not the hosting companys 'default' page. Test this by whacking in the IP and if your website shows up all good, if the hosting companys page shows up whoops.

    A good hosting company with good support should be able to do this for you, especially if your running a big enough account (which if you're wildcard SSL'ing I imagine you are).

    I did this but I had the hosting company flip the primary domain of the account before I installed multisite, therefore I think you might have an issue with network.example.com not thinking it's the multi-site network. But you should be able to get around this by pointing it to example.com's subdirectory, or by "installing" multisite on network.example.com as in copying the code into it's htaccess.

    It's a masking tape setup. You're other option is the multi-site in multi-site plugin. Setup example.com as a multisite, then give it 1 subdomain site network.example.com and set that up as multi-site, and run everything out of that. Use the domain mapping plugin to loop network.example.com back to example.com.

    Checklist:

    hosting account primary domain correct
    primary domain multi-site setup and htaccess code in
    subdomains correct url
    subdomains correct directory
    dns a records correct
    dns cname records correct
    subdomains multi-site setup and htaccess code in
    domain mapping plugin installed and configured correctly
    htaccess configured with any custom rewrites

    Final Note: When I did this, when I put in the domain name into the domain mapping plugin, it would come up red "error, couldn't map !bad!" BUT it did in fact work. Even though it was saying it wasn't, my testing and the fact the site is all working proves different. So just because it shows up the red error in the plugin interface in wordpress dashboard does NOT mean it's not working.

    Always double check with multiple browsers, make sure your dns is correct, flush it on your client pc's for testing etc.

    Final Idea:

    There is a custom login dashboard plugin that you could configure to detect the username the person types in and have it redirect to the subdomains/subdirectories site and I'm sure you could mask the URL if that was completely essential. An iframe could do it, with a piece of custom code on each logins dashboard to exit the iframe and reopen the page in the browser (it would have the cached credential). There's a plugin that can put stuff on all users dashboards in an instant you could use for embedding that.

    That's all I got. I hope it was helpful. Good luck.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.