Wordpress admin login cookies blocked error after moving servers

后端 未结 15 1790
被撕碎了的回忆
被撕碎了的回忆 2020-12-24 14:13

Background: had a working Wordpress 3.7 site at olddomain.com.

I moved it to newdomain.com successfully, and in the process added this to wp-config:

         


        
15条回答
  •  自闭症患者
    2020-12-24 14:27

    I created my Multisite install long ago when you needed a plugin for domain mapping. So I had the file '/wp-content/sunrise.php' and in the wp-config define( 'SUNRISE', 'on' ); It's been working just fine until a recent update to WordPress.

    I viewed these errors in my debug.log:

    Undefined index: HTTP_HOST in ../public_html/wp-content/sunrise.php on line 10
    Undefined index: HTTP_HOST in ../public_html/wp-includes/ms-settings.php on line 57
    

    So I deleted the sunrise file and wp-config sunrise definition and added @max4ever/@duck_boy's cookie definitions to the wp-config file:

    define('ADMIN_COOKIE_PATH', '/');
    define('COOKIE_DOMAIN', '');
    define('COOKIEPATH', '');
    define('SITECOOKIEPATH', ''); 
    

    That solved the problem. I can now login!! Note: I tried this definition and it worked as well. Taken from Multisite Setup Guide

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

提交回复
热议问题