domain mapping not working correctly

I have three domain names that are not mapping correctly to three different subsites in my multisite environment.

Sometimes they direct properly, some times they do not. They have a better likelihood of directing properly when I enter http:// in the browser, but that doesn't always work (and I've cross checked this on three different browsers). Two of them are being redirected to mainsitename.com/client_center/ which is a whmcs page. That page is assigned within wordpress as the default homepage of the multisite environment. They should be going to subsite1.com and subsite2.com respectively. The third domain name is being redirected to mainsitename.com/subsite3 instead of subsite3.com

I've verified that the A records are configured correctly.
And I have tried all three options available within the domain mapping plugin (e.g. "disabled and entered domain name should be used", "directed to mapped (primary) domain", and "directed to original domain") with no notable difference in the outcome.

Any ideas?

  • Tyler Postle
    • CGO

    Hey Bladerunner,

    Hope you're doing well today and thanks for your question!

    Do you mind letting me know which subsites these are so I can test them out first hand? I tried a couple and didn't see any issues so far.

    I also tested this on my own installation by selecting a static front page and visiting my mapped domain, still didn't see the issue.

    If you don't want to mention your client sites then perhaps just mention the first first part of their site title, then I will find it in the My Sites list you have :slight_smile:

    Look forward to hearing back Bladerunner!

    All the best,
    Tyler

  • Tyler Postle
    • CGO

    Hey xbladerunner,

    Hope you're doing well today and thanks for providing that :slight_smile:

    It's funny(not really) but when I was beta testing this version a similar issue happened to me; however, it only happened once and I was never able to replicate it and neither was anyone else.

    I went in and re-mapped your domains and selected "directed to mapped domain". They all seem to be working as expected now!

    If this ever happens again just unmap then remap the domain. Then it should be good to go!

    Thanks for your patience here and let me know if you still have any further issues :slight_smile:

    All the best,
    Tyler

  • xbladerunner
    • Syntax Hero

    Thanks Tyler,

    I'm not noticing any difference.
    americanpeacenik.com is redirecting reliably to https://naturaldaddy.com/americanpeacenik
    but xbladerunner.com and iwebspider.com still mostly redirect to https://naturaldaddy.com/client_center/
    About 50% of the time, if I add "http://" to the beginning they will properly redirect, but not 100% of the time...
    I've tried remapping them as you suggested, but still no joy.

    Ash recently helped me write a custom mu plugin for redirecting logins, https://premium.wpmudev.org/forums/topic/redirect-to-bp-profile-upon-login#post-766744
    Do you mind taking a look at the code and seeing if that could be the problem or if it is related? The configuration that caused the need for that custom plugin is one of the only things different about this set up from my other multisite environments -- just trying to narrow down what the issue may be.

  • Tyler Postle
    • CGO

    hey xbladerunner,

    Sorry for my delay here!

    I see the issue is still happening. This just started happening after the update right? I'm wondering if maybe something in the update is causing this.

    It doesn't look like that custom code should affect this. You can try temporarily removing Ash's code to see if that resolves the issue though.

    Or try rolling back to the previous version: https://premium.wpmudev.org/manuals/using-wpmu-dev/downloading-previous-versions-of-plugins-and-themes/

    That way we can narrow this issue down further :slight_smile:

    Look forward to hearing back Blade!

  • xbladerunner
    • Syntax Hero

    Thanks Tyler,

    I've got it partly figured out now.

    Retroversions of the domain mapping plugin don't change the outcome, nor does eliminating Ash's code... but I did figure out that if I change the admin reading settings of the front page to something other than what I'm currently using, the domain mapping works fine...

    As I mentioned before, I have those settings configured to point to my whmcs install. I currently do this via the "external permalinks redux" plugin, which sends any visitors of the wordpress site front page to the whmcs site front page.

    So I either need an alternative way to send front page visitors to the whmcs site, or a way for the domain mapping plugin to play nice with my altered front page permalink. Any suggestions?

  • Tyler Postle
    • CGO

    Hey Blade,

    Hope you're doing well today!

    I've been testing this out with the permalinks redux plugin you mentioned and I'm unable to replicate the issue yet. So you have a page set to your front page and that page it set to your whmcs installation with the permalink redux plugin? Just want to make sure I have it setup right on my test install.

    Look forward to hearing back here Blade!

    Talk to you soon.

    Cheers,
    Tyler

  • Tyler Postle
    • CGO

    Hey Blade,

    Thanks for the quick reply.

    Could you send your FTP and WP login in? Then we can further debug this and I can get one of our coding experts to take a closer look as I'm not able to replicate this on my own install.

    Send in:

    Subject: "Attn: Tyler Postle"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me :slight_smile:

    https://premium.wpmudev.org/contact/

    Talk to you soon!

    Cheers,
    Tyler

  • Tyler Postle
    • CGO

    Hey Blade,

    Thanks for sending that in!

    I was just looking around at your site and noticed your mapped domains are currently showing as invalid, are you currently experiencing other issues as well?

    Instead of using the permalinks redux plugin, can you try just a basic 301 redirect plugin like this one here: https://wordpress.org/plugins/redirection/

    and redirect to your WHMCS page that way :slight_smile:

    I'm still not able to replicate your issue with the redux plugin; however, if this redirection plugin method doesn't work either then we will call in the coding experts to take a closer look and see if we can provide a workaround.

    Thanks for all your patience so far blade! Talk to you soon.

    Cheers,
    Tyler

  • xbladerunner
    • Syntax Hero

    Thanks Tyler,

    This might be related... I recently migrated the site to a different server and I'm noticing that the IP address that domain mapping is telling people to use is actually the old IP address, not the current dedicated IP... I've tried turning it off and back on again to no avail, still the old IP address is showing up. I've tried recreating the A record to point at both the old and the new IP address to no avail...

    I've recreated the A records of xbladerunner.com, iwebspider.com, and americanpeacenik.com with the "real" dedicated IP address, and they are all now vaildating. and two of the three are redirecting correctly (xbladerunner.com still is not, even with all plugins (minus domain mapping) deactivated). complete mystery to me.

    I tried the redirection plugin but it doesn't work to redirect the frontpage, only pages... Even with external permalinks plugin activated the sites are now validating, and they are redirecting as well now, except for xbladerunner.com

    So... any ideas on what is going on with the xbladerunner subsite, and why that old IP persists in the domain mapping instructions?

  • aristath
    • Recruit

    Hello again @xbladerunner, I hope you're well today!

    You can create a new php file in your wp-content/mu-plugins folder (if that folder does not already exist, manually create it).
    In that file, paste the following and change the IP on line 6 to your actual IP:

    <?php
    
    function force_new_domain_mapping_ip() {
    
    	// Edit the below line and enter your own IP.
    	$new_ip     = '127.0.0.1';
    
    	// Get the domain mapping options from the DB.
    	$dm_options = get_site_option( 'domain_mapping', array() );
    	$dm_ip      = $dm_options['map_ipaddress'];
    
    	// If the options i nthe db is not the same as our new IP
    	// update the option and save it.
    	if ( $new_ip != $dm_ip ) {
    		$dm_options['map_ipaddress'] = $new_ip;
    		update_site_option( 'domain_mapping', $dm_options );
    	}
    
    }
    add_action( 'init', 'force_new_domain_mapping_ip' );

    Save it and refresh your site.

    That should update the IP in your database and force the new IP.

    I hope that helps!

    Cheers,
    Ari.

  • xbladerunner
    • Syntax Hero

    Hello, I'm reopening this thread as I continue to have the same problem... The issue is occurring with every domain I try to map... Here is an example of the issue: when mapping americanpeacenik.com to https://naturaldaddy.com/americanpeacenik, I get https://naturaldaddy.com/americanpeacenik, instead of http://americanpeacenik.com

    I've tried all different combinations of the domain mapping settings, such as map to original domain, map to primary domain, disable and map to entered domain -- all return to https://naturaldaddy.com/americanpeacenik Any ideas why this isn't working?

  • Tyler Postle
    • CGO

    Hey Bladerunner,

    Hope you're doing well today!

    We have a big update that should be coming out within the next few days here(in final testing stage) that has a lot of fixes and a lot of added features too, hopefully that will do the trick here :slight_smile: if not, then we will definitely troubleshoot this further and get it sorted out.

    Look forward to hearing back on this after the release. If you have any further questions in the meantime let us know :slight_smile:

    Cheers,
    Tyler

  • Tyler Postle
    • CGO

    Hey xbladerunner,

    Apologies for my delay here!

    I checked your site and all the images are showing up on the mapped site correctly from what I can tell. Is that right? :slight_smile: looks like this is resolved.

    If you're still having any further issues here just let us know.

    All the best,
    Tyler

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.