简体   繁体   English

升级到3.5.1后,WordPress管理员停止工作

[英]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: 但这通常需要安装新的插件...几件事情:

  1. Try to increase the RAM available. 尝试增加可用的RAM。 WP has given me hassles in the past similar to this and it was RAM related. WP在过去给了我类似的麻烦,这与RAM有关。 You should be able to increase the RAM in your .htaccess file 您应该能够增加.htaccess文件中的RAM
  2. Is this a production system? 这是生产系统吗? If not, perhaps make a note of all the plugins, delete them, try access the system. 如果不是,请记下所有插件,将其删除,然后尝试访问系统。 If that works, then you know the issue was plugin based and not WP itself. 如果可行,那么您知道问题是基于插件的,而不是WP本身。 You can then systematically add the plugins back one by one and determine which one caused the issue. 然后,您可以系统地将插件一个接一个地添加,并确定哪个插件引起了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM