Can't access wp-admin/network after installing Domain Mapping plugin

Hi

I’ve installed the Domain Mapping plugin and mapped my original blog addresses to new domains. Now I don’t seem to be able to access the network admin – I just get redirected from myOldDomain.com/wp-admin/network to myOldDomain.com/wp-login.php and from there to myOldDomain.com.

Also, which I guess is related, I can’t hit the dashboards of any of the blogs except the main one.

Where am I going wrong?

Many thanks.

  • g01010
    • WPMU DEV Initiate

    Hi Phil

    Thanks for coming back so quickly.

    MyOldDomain.com is the main domain. It’s mapped to newsub.MyNewDomain.com

    I’m pretty sure I followed the instructions to install correctly. Everything else seemed to work fine… But I’ve obviously gone wrong somewhere along the line.

  • Timothy
    • Chief Pigeon

    Hey there! :slight_smile:

    Just checking in to see how things are going with this one and if you need any further help. :slight_smile:

    We haven’t heard from you on this thread for a while, perhaps you got help over our email. I’m going to presume your all fixed up now and don’t need any further assistance.

    However if you have more questions or need some more help then please feel free to respond in this thread or create a new one and we will be more than happy to offer assistance. :slight_smile:

    Take care.

  • g01010
    • WPMU DEV Initiate

    Okay, finally coming back to this and I think I need some help.

    I just deleted the mapping to my main domain – and I still can’t access the network admin. I’ve been through the documentation and I don’t know where I’m going wrong.

  • g01010
    • WPMU DEV Initiate

    So, to recap, here is the problem:

    I have a domain, a.com, on which I have installed multisite and the Domain Mapping plugin. I have (wrongly, it seems) mapped a.com to sub1.b.com. I’ve also mapped a.com/second-site to sub2.b.com (which is perfectly okay as far as I can see).

    My problem is now that I can’t access a.com/wp-admin/network (or even sub1.b.com/wp-admin/network). If I try to access either, I go to the log-in page, log in, then get redirected back to the log-in page. I can still access the dashboards of the individual blogs, just not the network admin.

    From earlier in this thread, I’ve learned that you’re not supposed to map the main domain (though I didn’t see this in the documentation for the plug-in). So my question is whether there is anything I can now do?

  • g01010
    • WPMU DEV Initiate
    <?php
    /**
    * The base configurations of the WordPress.
    *
    * This file has the following configurations: MySQL settings, Table Prefix,
    * Secret Keys, WordPress Language, and ABSPATH. You can find more information
    * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
    * wp-config.php} Codex page. You can get the MySQL settings from your web host.
    *
    * This file is used by the wp-config.php creation script during the
    * installation. You don't have to use the web site, you can just copy this file
    * to "wp-config.php" and fill in the values.
    *
    * @package WordPress
    */

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', '****');

    /** MySQL database username */
    define('DB_USER', '****');

    /** MySQL database password */
    define('DB_PASSWORD', '****');

    /** MySQL hostname */
    define('DB_HOST', 'localhost');

    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');

    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');

    /**#@+
    * Authentication Unique Keys and Salts.
    *
    * Change these to different unique phrases!
    * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
    * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
    *
    * @since 2.6.0
    */
    define('AUTH_KEY', 'w

    p>S@I]$/Voh:iSR+W7-Ne>?7s fV!BjIW/);k%kyGU-MOhGag*0^wG~?Iy~-CF’:wink:;

    define(‘SECURE_AUTH_KEY’, ‘<slT8M;|b1f=Id%Q_Q*Q[t8@0&NS3fV>R+X=sYKHd& ^IN[|;8l+I)w]^MoeF0′:wink:;

    define(‘LOGGED_IN_KEY’, ‘wG-Q1X8e!)#nee?E*JfJi$+n<yX&u,:Ut_g-m+qBdwoLb u3i%sG1=.4wb?#,EQ#’:wink:;

    define(‘NONCE_KEY’, ‘KMr@(<8DHR?:wink:~msmlnjt$yW[d3c37C=#G)__!tfv%HOgC*L)k66frnVdD`xm+4M’:wink:;

    define(‘AUTH_SALT’, ‘lCt*3E[$;A`h}nfBFXf-iwu+|hnOPaA?{TPF1Tc|}woxffa/rIph.0W,KX,&kH];’:wink:;

    define(‘SECURE_AUTH_SALT’, ‘kgJE_}Yo:k|1?`l?Hw)U*o@V:%7Hjsw^!][XUd;LL+L8~%38[z ][>fwV>d2&~0;’:wink:;

    define(‘LOGGED_IN_SALT’, ‘Ijop~4<^m%73soyV-e[j+=oh^<n1!R]4De$VdaT^AEuP?j^^}s|z8Xf@Oegd*~TE’:wink:;

    define(‘NONCE_SALT’, ‘+W~l=SUlL/SV6rZ2^<>f 2>f?YV5H5K?eX#he$T>F>e+UIgM]8wbftjqM@{?;3,W’:wink:;

    /**#@-*/

    /**

    * WordPress Database Table prefix.

    *

    * You can have multiple installations in one database if you give each a unique

    * prefix. Only numbers, letters, and underscores please!

    */

    $table_prefix = ‘wp_’;

    /**

    * WordPress Localized Language, defaults to English.

    *

    * Change this to localize WordPress. A corresponding MO file for the chosen

    * language must be installed to wp-content/languages. For example, install

    * de_DE.mo to wp-content/languages and set WPLANG to ‘de_DE’ to enable German

    * language support.

    */

    define(‘WPLANG’, ”:wink:;

    /**

    * For developers: WordPress debugging mode.

    *

    * Change this to true to enable the display of notices during development.

    * It is strongly recommended that plugin and theme developers use WP_DEBUG

    * in their development environments.

    */

    define(‘WP_DEBUG’, false);

    define(‘WP_ALLOW_MULTISITE’, true);

    define( ‘MULTISITE’, true );

    define( ‘SUBDOMAIN_INSTALL’, false );

    $base = ‘/’;

    define( ‘DOMAIN_CURRENT_SITE’, ‘digitalcatapult.co.uk’ );

    define( ‘COOKIE_DOMAIN’, ‘.samsltd.co.uk’:wink:;

    define( ‘PATH_CURRENT_SITE’, ‘/’ );

    define( ‘SITE_ID_CURRENT_SITE’, 1 );

    define( ‘BLOG_ID_CURRENT_SITE’, 1 );

    define( ‘SUNRISE’, ‘on’ );

    /* That’s all, stop editing! Happy blogging. */

    /** Absolute path to the WordPress directory. */

    if ( !defined(‘ABSPATH’:wink: )

    define(‘ABSPATH’, dirname(__FILE__) . ‘/’:wink:;

    /** Sets up WordPress vars and included files. */

    require_once(ABSPATH . ‘wp-settings.php’:wink:;

    `

  • Barry
    • DEV MAN’s Mascot

    Can you delete these lines:

    define( 'DOMAIN_CURRENT_SITE', 'digitalcatapult.co.uk' );
    define( 'COOKIE_DOMAIN', '.samsltd.co.uk');
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    and see if that helps.

  • g01010
    • WPMU DEV Initiate

    I see… So if I understand it correctly, I can have it set up so that:

    -> Users can log into the main blog and be automatically logged into their own blog – but I can’t get into the network admin, or

    -> I can get into network admin but users can’t log in to their own blog via the main blog

    Allowing users to log in once across multiple blogs is pretty much the reason that I went for multisite… Earlier in this thread, it was suggested that I shouldn’t have mapped the main blog. If I created another sub-blog and moved my main content there (and mapped it to subdomain.newsite.com), would a user be able to log in to that sub-blog and be automatically logged into other sub-blogs on the site?

  • Barry
    • DEV MAN’s Mascot

    Earlier in this thread, it was suggested that I shouldn’t have mapped the main blog.

    Nope, certainly shouldn’t have, how you have is a mystery :slight_smile: because the plugin tries very hard to prevent you from doing that.

    would a user be able to log in to that sub-blog and be automatically logged into other sub-blogs on the site

    If they are on the same domain then yes, if they are on mapped domains then no.

    Your browser prevents the creation of cookies for domains other than the one you are visiting, and only allows the reading of cookies from the domain you are on. So, when you login to wordpress, wordpress creates a cookie for the domain you logged into to highlight that fact and so you don’t have to keep logging in for every page.

    If you visit from another domain, it looks for a logged in cookie, but because the cookie created earlier is on a different domain, then the browser can’t see it and therefore you are not logged in.

    Domain mapping uses a method to create a fake cookie when you log in to a mapped domain to also create a login cookie on the main domain of the site. Using this, the user who logged in can access their own domain mapped site and any site on the main domain (via the fake cookie). As a cookie isn’t created for every single mapped domain (which would be hugely costly in terms of processing / page load) they won’t be able to automatically go to every mapped domain on your site without having to login to those separately.

    Hope that makes sense.

  • g01010
    • WPMU DEV Initiate

    Nope, certainly shouldn’t have, how you have is a mystery :slight_smile: because the plugin tries very hard to prevent you from doing that.

    I like to push the boundaries as much as possible… By the main blog, I mean the first one I set up, the one with blog_id=1. Have I got my definition right here, because I didn’t have much in the way of the plugin trying to prevent me mapping that?

    Hope that makes sense.

    Hmm, partly. What about if they’re mapped to different subdomains of the same main domain?

  • Barry
    • DEV MAN’s Mascot

    What about if they’re mapped to different subdomains of the same main domain

    For multisite the cookie domain is set to .yourdomain.com (it’s one of the lines you removed from the config, primarily because it was preventing the sunrise.php from assigning the correct mapped domain cookie domain later on), so that covers http://www.yourdomain.com, mysite.yourdomain.com, fred.yourdomain.com and so on for sub-domains, and all sub-directory based blogs because they are on the main domain anyway.

    By the main blog, I mean the first one I set up, the one with blog_id=1.

    Yep, that’s the one I mean – there is (should be) a line of code in the plugin that rejects any domain mapping settings for the blog with the id of 1 as mapping that domain causes a lot of problems with cookies :slight_smile:

  • g01010
    • WPMU DEV Initiate

    Sorry – can you clarify that for me? If I’ve mapped folder-based blogs to different sub-domains of the same domain, then users should be able to log into one blog and access others? I’m not clear.

    E.g:

    oldsite.com/blog-a —-> sub-a.newsite.com

    oldsite.com/blog-b —-> sub-b.newsite.com

    Presumably I need to remove the domain mapping for blog_id 1 and move the content to a sub-blog, then map that? There’s nothing that I can recall that tried to prevent me mapping this blog.

    Thanks for your help.

  • Barry
    • DEV MAN’s Mascot

    Can I ask a different question :slight_smile:, namely that this seems to be a very roundabout way of doing things :slight_smile: Why not just have a site at newsite.com set for subdomains and put the sites on there? Would be a lot less hassle.

    In answer to your question though. The plugin isn’t expecting anyone to do that to be honest, it’s expecting someone to map a domain and thus creates the main cookie for the mapped domain as the full domain, not for the shortened version. It then creates a shortened fake cookie for the main domain (which it can’t find properly in this case because you have it mapped to a different one).

    So, when you login to sub-a.newsite.com it creates a logged in cookie for .sub-a.newsite.com which works only on that site (as it assumes you are mapping a domain not a subdomain) and tries in your example to create a cookie for .oldsite.com, but because the main site is mapped it actually creates cookie for .othermappeddomain.com, so you lose out on a lot of the functionality.

    From what you’ve written so far, I’m wondering if this plugin https://premium.wpmudev.org/project/multi-domains might not be a better fit, then you can create the sites directly at the relevant domains rather than trying to map them?

  • g01010
    • WPMU DEV Initiate

    Basically, newsite.com already has a WordPress site running on it. I wanted to be able to leave that as it was and run modular training from it… so the user would log in centrally and access modules. Each module is a separate blog. And because I didn’t want to move the original WordPress site, I created a new multisite on a different domain and looked to map each sub-blog to subdomains of the original site. So that’s the method behind the madness… but having said all that, it’s probably more madness than method.

    Anyhow, I will check out the multi-domain plug-in. Sounds like it could be what I need. Thanks for all your help.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.