multisite - MU domain mapping login issue

From this answer, a MU site has the following in wp-config.php:define('WP_ALLOW_MULTISITE', true );define(�

From this answer, a MU site has the following in wp-config.php:

define('WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'www.example');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('COOKIE_DOMAIN', '');
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');

If I try to login to a child site @ .php, I receive the error:

The constant "COOKIE_DOMAIN" is defined (probably in wp-config.php). Please remove or comment out that define() line.

If I comment out:

define('COOKIE_DOMAIN', '');

I receive the error:

ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress

The site the answer above refers to is working with the definitions above.

Any ideas why the same definitions are not working on this earlier installed Wordpress? (perhaps from around v4.3?)

From this answer, a MU site has the following in wp-config.php:

define('WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'www.example');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('COOKIE_DOMAIN', '');
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');

If I try to login to a child site @ http://example2/wp-login.php, I receive the error:

The constant "COOKIE_DOMAIN" is defined (probably in wp-config.php). Please remove or comment out that define() line.

If I comment out:

define('COOKIE_DOMAIN', '');

I receive the error:

ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress

The site the answer above refers to is working with the definitions above.

Any ideas why the same definitions are not working on this earlier installed Wordpress? (perhaps from around v4.3?)

Share Improve this question edited Apr 13, 2017 at 12:37 CommunityBot 1 asked Mar 27, 2017 at 11:02 SteveSteve 1,77719 gold badges66 silver badges115 bronze badges 3
  • You are defining "COOKIE_DOMAIN" twice in your above code. Remove one of them. – Spartacus Commented Apr 4, 2017 at 20:56
  • Thanks @Spartacus. I now no longer receive the cookie error. I have reset the password on example, but this does not let me login @ example2/wp-login.php. I receive no error at the login screen, it just reloads the same page. – Steve Commented Apr 5, 2017 at 4:05
  • Turn on the debug mode and check if there is any error... – BlueSuiter Commented Apr 6, 2017 at 11:48
Add a comment  | 

5 Answers 5

Reset to default 3

Strangely it worked for me (on more than one multisites) to set SUBDOMAIN_INSTALL to false. To be honest, I hadn't had time to investigate further why ...

define('SUBDOMAIN_INSTALL', false);

Ensure sunrise.php is in the wp-content directory and that you have defined the following in wp-config.php:

define( 'SUNRISE', 'on' );

With sunrise on, you should not define COOKIE_DOMAIN anywhere else as it handles that dynamically on all mapped domains.

My guess is that either you don't have define( 'SUNRISE', 'on' ); or you don't have sunrise.php installed correctly. Another thing to check would be that the domain is correctly configured in wp-admin.

For anyone still struggling with this. It turned out it was the sunrise code that was causing the conflict:

<?php
if ( !defined( 'SUNRISE_LOADED' ) )
    define( 'SUNRISE_LOADED', 1 );

if ( defined( 'COOKIE_DOMAIN' ) ) {
    die( 'The constant "COOKIE_DOMAIN" is defined (probably in wp-config.php). Please remove or comment out that define() line.' );
}

...

I commented out the sunrise in wp-config.php

//define( 'SUNRISE', 'on' );

And added

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

before the /* That's all, stop editing! Happy blogging. */ comment.

That made me login to my multisite again and all sub sites, but worked like a charm!!!

Really hope this helps someone else struggling with this very very frustrating issue. :)

the first error come from additionnal code which would probably not be usefull with the actual WordPress version (4.7.3 today)

try to comment the line define("SUNRISE"... in wp-config.php

I bypassed the inbuilt Wordpress domain mapping, and instead used the Wordpress MU Domain Mapping plugin, which proved to be much easier to maintain and troubleshoot.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744916214a4600850.html

相关推荐

  • multisite - MU domain mapping login issue

    From this answer, a MU site has the following in wp-config.php:define('WP_ALLOW_MULTISITE', true );define(�

    2天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信