Search code examples
phpwordpresshttpsadmin

Wordpress admin dashboard disabled after migration to another server and https


Disclaimer: I don't now WordPress on any level, so if I provided with not enough of details or you need some extra information please let me know.

Hello, I have migrated with some 'legacy' WordPress project to new server and Https . And faced with following problem:

1) To hide wp-adming and wp-login, there was installed plugin WPS hide login. e.g. it leads to example.com/blog/hiddenurl/;

2) After it was moved to new server and https was enabled - it seems to became broken as doesn't redirect me to admin dashboard.

3) When I am trying to access wp-admin directly it gives me This has been disabled message.

I suppose that this might be ralated to https, as I have already applied hack from here .

Besides this problem seems to be already raised before few times, e.g. on forum . But there no helpful answers, expect disable some plugin and there are no this plugin installed. The only thing which seems to be a little bit is folder 'redirects' inside /plugins directory. Could some please help me to solve this problem (maybe someone already faced before with such kind of problem)? Or at least give some advice regarding this, e.g. maybe more efficient might be do disable wps plugin and move wp login and admin to another urls manually?

Best regards.


Solution

  • There's some things to verify to access to the admin dashboard.

    Did you use a plugin like ReallySimpleSSL to manage the changes between http->https ?

    This plugin add a piece of code in the wp-config.php and in the main htaccess.

    Here is the section add that you can put in your htaccess :

    # BEGIN rlrssslReallySimpleSSL rsssl_version[2.3.5]
    
    <IfModule mod_rewrite.c>
    
    RewriteEngine on
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
    </IfModule>
    
    # END rlrssslReallySimpleSSL
    
    # BEGIN WordPress
    

    Maybe that can make the job.

    Did you correct the options siteurl and home ? Now that you are not able to access to the admin settings, you'll need to change it manually with phpMyAdmin or with a script in functions.php

    function se_40436883(){
    
        if(get_option('rescue_se_40436883') != 1){
            update_option( 'siteurl', 'https://example.com' );
            update_option( 'home', 'https://example.com' );
            update_option( 'rescue_se_40436883', 1);
        }
    
    }
    add_action('init', 'se_40436883');
    

    One another possible way is to add try to change directly some Define in the wp-config.php

    define('FORCE_SSL_ADMIN', true);
    
    define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
    define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
    define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
    

    Hope you'll get your admin back with that !