[英]Wordpress admin stopped working after upgrade to 3.5.1
Today I tried to update Wordpress to the latest version (3.5.1). 今天,我尝试将Wordpress更新到最新版本(3.5.1)。 After doing this, I can't open
wp-admin/index.php
anymore. 完成此操作后,我无法再打开
wp-admin/index.php
。 It gives me a 404 error. 它给我一个404错误。 I've looked into the
index.php
file and it breaks when the function auth_redirect()
is called. 我已经研究了
index.php
文件,当调用函数auth_redirect()
时它会中断。 Here's the code of that function: 这是该函数的代码:
function auth_redirect() {
// Checks if a user is logged in, if not redirects them to the login page
$secure = ( is_ssl() || force_ssl_admin() );
$secure = apply_filters('secure_auth_redirect', $secure);
// If https is required and request is http, redirect
if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
exit();
} else {
wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
exit();
}
}
if ( is_user_admin() )
$scheme = 'logged_in';
else
$scheme = apply_filters( 'auth_redirect_scheme', '' );
if ( $user_id = wp_validate_auth_cookie( '', $scheme) ) {
do_action('auth_redirect', $user_id);
// If the user wants ssl but the session is not ssl, redirect.
if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
exit();
} else {
wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
exit();
}
}
return; // The cookie is good so we're done
}
// The cookie is no good so force login
nocache_headers();
$redirect = ( strpos( $_SERVER['REQUEST_URI'], '/options.php' ) && wp_get_referer() ) ? wp_get_referer() : set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$login_url = wp_login_url($redirect, true);
wp_redirect($login_url);
exit();
}
However I can't find the specific part where it breaks, since it's not giving me an error message, it just shows a 404 page, and in Firefox it says it's not redirecting correctly. 但是我找不到它断开的特定部分,因为它没有给我错误消息,它只显示404页面,在Firefox中它表示未正确重定向。
Could someone please help me out on this? 有人可以帮我这个忙吗?
Thank you! 谢谢!
Some additional information: 一些其他信息:
I've found the line where it breaks, it is: 我发现它折断的行是:
wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
Echoing $_SERVER['HTTP_HOST']
and $_SERVER['REQUEST_URI']
gives me the expected result (www.domain.com/blog). 回显
$_SERVER['HTTP_HOST']
和$_SERVER['REQUEST_URI']
给了我预期的结果(www.domain.com/blog)。 However it just doesn't work :( 但是,它根本不起作用:(
I have had similar issues in the past. 过去我也遇到过类似的问题。 But it usually involves a new plugin installation... Couple of things:
但这通常需要安装新的插件...几件事情:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.