2015-07-03 142 views
1

當登錄wp-admin經由302WordPress的 - /可溼性粉劑管理員/重定向到/wp-login.php,登錄


重定向到wp-login.php時,有2組的行爲:

1)用戶名/密碼正確。 302重定向到/ wp-admin /後跟302重定向到/wp-login.php

2)輸入的用戶名/密碼錯誤,沒有重定向。 200響應與「錯誤:不正確的用戶名或密碼」。顯示。


WordPress的配置(我已經替換爲 「testdomain.com」 真正的域名):

$_SERVER['HTTPS']='on'; 

define('FORCE_SSL_LOGIN', false); 
define('FORCE_SSL_ADMIN', false); 

if (!defined('ABSPATH')) 
    define('ABSPATH', dirname(__FILE__) . '/'); 

//$currenthost = "https://".$_SERVER['HTTP_HOST']; 
$currenthost = "https://exampledomain.com"; 
$currentpath = preg_replace('@/[email protected]','',dirname($_SERVER['SCRIPT_NAME'])); 
$currentpath = preg_replace('/\/wp.+/','',$currentpath); 
define('WP_HOME',$currenthost.$currentpath); 
define('WP_SITEURL',$currenthost.$currentpath); 
define('WP_CONTENT_URL', $currenthost.$currentpath.'/wp-content'); 
define('WP_PLUGIN_URL', $currenthost.$currentpath.'/wp-content/plugins'); 
define('DOMAIN_CURRENT_SITE', $currenthost.$currentpath); 
define('ADMIN_COOKIE_PATH', './'); 
define('WP_BASE', $currenthost.$currentpath); 
define('FS_METHOD', 'direct'); 
define('FS_CHMOD_DIR', (0705 & ~ umask())); 
define('FS_CHMOD_FILE', (0604 & ~ umask())); 

任何想法?

+0

機會是因爲它是非常罕見的,這是不是你的問題,但我想我應該提到它,也許它會在某個時候幫助某個人:我前一段時間看到過這種行爲,並且跟蹤它是由於數據庫服務器沒有足夠的空間而引起的。 – mishu

+0

@mishu這是非常有趣的,謝謝! – RadiantHex

回答

1

如果您確信您的登錄憑據是正確的,你可以使用「wp_authenticate」鉤如下:

add_action('wp_authenticate', 'mysite_check_already_logged_in'); 

function mysite_check_already_logged_in() { 

    if (is_user_logged_in()) { 
     wp_redirect(site_url('wp-admin')); 
    } 
} 
相關問題