Domain Issues in Multisite

We recently expanded to a second server with LiquidWeb for performance gains. I'm running into some issues with mapping domains and serving our own public site.

Root WP multisite install at: https://nettechdata.com
I initially thought I could use the root site as our public website. But when I tried to map a domain to it, I found the domain mapping plugin was unavailable for the root site. So I cloned to a subsite: https://ntpub.nettechdata.com where I could map our public domain (https://nettech.net) to it. This is working, serving the subsite as our public site on our primary (nettech.net) domain.

Problem: The original root site is still being served from our root domain (nettechdata.com), but it is not updated, as our public site is actually at ntpub.nettechdata.com, so if anyone errantly goes to nettechdata.com, they get a broken site.

Is there any way (within WordPress admin) for me to point nettechdata.com (which is my root) as a redirect to a subsite within itself (ntpub.nettechdata.com), or is it up to us to make sure no one visits that URL directly?

I don't want to screw around with my DNS and create any loops, but I don't see any way to make it work. Just want to make sure I'm not overlooking something.

Thanks,

Josef

  • Rupok

    Hi Josef,

    Thanks for asking. This is a complex situation because in Domain Mapping, main site plays a big role. When you map any domain to any of your subsite, that domain hits your server with your IP address and your server provides the main site to that domain request. When the request comes to your main site, it redirects that request to appropriate sub site. So if you redirect your main site with htaccess or DNS, chances are high that it will break your setup.

    I think there is a easy workaround for this situation. That is: deleting all pages and posts from your main site and keep only one page. On that page, you can write that "nettechdata.com has permanently moved to https://nettech.net" with a link to nettech.net and set that page as homepage from your main site "Dashboard > Settings > Reading" section. So if anyone goes to nettechdata.com, he will see this message and as he won't have any other link to click on that page, he will click that nettech.net link and eventually arrive on nettech.net site. You can also create a custom page template for that page which can be totally blank with only that message written. To know about how you can create a custom page template, you can check this tutorial: https://premium.wpmudev.org/blog/creating-custom-page-templates-in-wordpress/

    What do you think about this? If you have any confusion or if you are stuck at any point, please let us know. We will be glad to assist further.

    Have a nice day. Cheers!
    Rupok

  • Josef Cook

    Rupok,

    I think you are correct. There is not totally graceful solution. For the current solution we have applied John Godley's popular Redirection plugin, redirecting each page at nettechdata.com to its counterpart on nettech.net.

    Although the plugin supports REGEX for wildcard redirections, we were unable to use them. While the front-end redirects with wildcards worked beautifully, they also redirected our wp-admin and wp-login.php into infinite loops. We considered extending the plugin to incorporate an exclusion list, but with the small set of pages in our public site, it wasn't worth the time investment.

    Single page redirects on our root URL have done the trick for now. If we start getting complaints from users who typo a character or manage to bypass the redirects in some other fashion, we may revert to the stripped down root site as you suggested. Thanks for your time and insight!

    Josef