Domain mapping issues

I’ve used WPMUDEV Domin Mapping plugin but it caused me several issues. So I’ve deactivated it and went with WP manual Domain Mapping.

But now some of the mapped sites’ users lost the admin toolbar and the “Super admin” can’t access the mapped domain form the dashboard. I got redirected to the WP Login Page.

  • kalico
    • The Bug Hunter

    Thanks @ Mohammad for setting this up! I am aware that you guys will need access to server files to address this, and we (my company) have major security hoops to jump through to get you that access. We don’t use cpanel (we’re on AWS) and we don’t allow FTP access. :grimacing:

    Internally we use SSH only, and I can set that up for you, but I will need a static IP address for the person who will be working on this issue. I realize that’s a lot to ask, and sometimes, by the time we get that all set up, the IP address or the person to work on it has changed.

    But I had another idea. :bulb: What if we allow file editing from the WP backend? Would that give you enough to work with?

  • kalico
    • The Bug Hunter

    I have some additional information.

    1) I am not the only one who experienced a sudden failure of domain mapping in the last couple of weeks. The main symptoms appear to be no admin toolbar, and a redirect problem in admin. The issue is not limited to the wpmudev legacy plugin. It happened with this one also: see most recent support tickets filed at https://wordpress.org/support/plugin/wordpress-mu-domain-mapping/

    2) Here is the redirect I am getting when I click on My Sites >> The NROC Project (which should take me to https://nroc.org/wp-admin/), as reported by the Ayima Chrome extension:

    Status Code URL IP Page Type Redirect Type Redirect URL

    302 https://nroc.org/wp-admin/ 35.165.196.227 server_redirect temporary https://nroc.org/wp-login.php?redirect_to=https%3A%2F%2Fnroc.org%2Fwp-admin%2F&reauth=1

    200 https://nroc.org/wp-login.php?redirect_to=https%3A%2F%2Fnroc.org%2Fwp-admin%2F&reauth=1 35.165.196.227 normal none none

    This is NOT something I set up anywhere. This started happening on its own for no apparent reason. No updates on my site when the problem started. This makes locating the source of trouble very difficult.

  • Nithin
    • Support Wizard

    Hi kalico,

    But I had another idea. :bulb: What if we allow file editing from the WP backend? Would that give you enough to work with?

    I’m afraid, static IPs are something which I’m not sure we could provide at the moment, almost everyone has a dynamic IP. Will check anyways to see a static IP is possible or not.

    Using the WP Backend would be a good idea to go through any specific files. I guess we can start with it for now. However, editing files via the WP Backend isn’t something that could be recommended, in case there is an error during changes, there could be chances the site going down without an option to revert it.

    Could I know which exact plugin you are using regarding this? So that we could check the server side, and wp-config.php file if needed.

    Just to be sure before noticing 301 errors mentioned, did you try re-mapping the domain via the WPMU DEV Domain Mapping plugin to see whether the issue got resolved? I have a test server, where I’m not able to replicate any issue in general with a Domain Mapping plugin, so the anomalies noticed seems to be site specific.

    Since you have disabled the WPMU DEV Domain Mapping plugin and opted to use the Native WordPress method to map the subsites. The issues what you have noticed that’s admin bar missing for a mapped domain, and mapped domain redirecting to login screen is the common issue noticed when using the native WordPress Domain Mapping method.

    This is the expected workflow with the native method. That’s the option to access mapped subsite dashboard and the admin bar is more of a WPMU DEV Domain Mapping feature. However, with native WordPress mapping, once you log in with the support admin account via the mapped domains dashboard URL, you should be able to notice the admin bar, and super admin could access the dashboard via the network page past this step only for the current session.

    1) I am not the only one who experienced a sudden failure of domain mapping in the last couple of weeks. The main symptoms appear to be no admin toolbar, and a redirect problem in admin. The issue is not limited to the wpmudev legacy plugin. It happened with this one also: see most recent support tickets filed at https://wordpress.org/support/plugin/wordpress-mu-domain-mapping/

    I’m afraid, I’m not fully sure how the MU Domain Mapping plugin works, as the plugin developer now supports to use the native WordPress method to map the domain, and it’s been over 3 years the plugin had an update too.

    Could you please try adding the following in the wp-config.php file, and check whether it makes any difference with dashboard login:

    define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']);

    Please make sure to place the above code, just before the line /* That’s all, stop editing! Happy blogging. */

    If the above solution define doesn’t help with accessing the dashboard of the mapped domain via super admin, could you please try adding the following code as a mu-plugins:

    <?php
    add_action('muplugins_loaded',function(){
    if(defined('MULTISITE') && MULTISITE && !defined('COOKIE_DOMAIN') && DOMAIN_CURRENT_SITE !== $_SERVER['SERVER_NAME']){
    if(1 === preg_match('/^(?:www.)?((?:[A-Za-z0-9_-]+.){1,3}[A-Za-z0-9_-]{2,})$/',$_SERVER['SERVER_NAME'],$aryMatches)){
    define('COOKIE_DOMAIN',$aryMatches[1]);
    }
    }
    });

    And then check whether it makes any difference? Please check this article on how to make use of mu-plugins:

    https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    Please let us know how that goes. Have a nice day ahead.

    Kind Regards,

    Nithin

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.