Question

/wp-admin & /wp-login.php doesn't work after moving website from shared hosting

Posted July 5, 2020 467 views
UbuntuApacheWordPress

Hello,

Background:
I moved my existing live WordPress website from Hostgator to DigitalOcean and now, I’m expecting to see it working with my IP - http://<ip> because I have not yet pointed my domain name yet (nameserver changes) and I don’t want to transfer as well and want to continue using website with http://<ip> inside DigitalOcean.

Problem: Currently, I’m able to open my website home page with IP address, but I’m unable to access /wp-admin or /wp-login.php.

Can someone help me what I could be doing wrong here?

Thank you.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi there @suchakmaulik179,

What is the exact error that you see when you try to visit /wp-admin?

I think that you might have to update your WordPress site and home URL to match your Droplet’s IP address so that you don’t get redirected to your domain name.

To do that just add those 2 lines to your wp-config.php file:

define( 'WP_HOME', 'http://your_server_ip_address' );
define( 'WP_SITEURL', 'http://your_server_ip_address' );

Another thing that I could suggest is to make sure that you’ve cleared your WordPress cache in case that you are using any caching plugins.

Another way of testing your site is to use your local hosts file and point your domain name to your Droplet’s IP address. That will affect only your PC and you will be able to fully test the functionality of your website directly via your domain name rather than having to change the site and the home URLs.

The location of the file is as follows:

  • Windows PC c:/windows/system32/drivers/etc/hosts

  • Mac and Linux /etc/hosts

Just open it up in your favorite text editor (e.g. Notepad) and add that line on the bottom:

your_server_ip_address yourdomain.com www.yourdomain.com

Once you have made the change, save the file and browse to your website as normal.

You will see it served from your new Droplet and will be able to test the full functionality of your CMS.

To view the site on your existing host, just remove the line from your hosts file.

Hope that this helps!
Regards,
Bobby

  • Hi Bobby,

    What is the exact error that you see when you try to visit /wp-admin?

    This is the error that I see - https://ibb.co/phTdXnQ (Site can’t be reached).

    To do that just add those 2 lines to your wp-config.php file:
    Yes, I’ve already done that. Other pages, <ip>/posts/post-name etc works fine now. But, it’s just wp-admin doesn’t work.

    Another thing that I could suggest is to make sure that you’ve cleared your WordPress cache in case that you are using any caching plugins.

    How do I do that? Disable the plug-ins or something else in addition? Also, how do I disable plugin if I’m unable to go to wp-admin of the new website?

    Just open it up in your favorite text editor (e.g. Notepad) and add that line on the bottom:
    yourdomain.com www.yourdomain.com - should this be literally your domain.com?

  • I have added comment but it says it’s in the ‘review’ for a past few hours, I’m not sure how long does it take usually?

  • Posting it again:

    Hi Bobby,

    I tried everything you mentioned here. It still doesn’t seem to be working. I even tried in another computer and still doesn’t work. Surprisingly, all my routes work except /wp-admin & other wp specifics routes like wp-login.php.

    • Hi there,

      To me, it looks like that your site is loading via HTTP, but when you visit your wp-admin it gets redirected to HTTPS. And if your webserver only listens on port 80, this would explain why you are seeing the connections refused message.

      To check if this is the case, SSH to your Droplet and run:

      sudo netstat -plant | grep 443
      

      If you do not see an output, then you would need to install an SSL certificate for your domain name and that way your webserver will start listening on port 443 as well.

      Regarding the caching, in order to disable a plugin without wp-admin access, you can just rename the plugin folder that’s inside the wp-content/plugins folder. Also, try to rename the wp-content/cache folder to wp-content/cache-old for example.

      Let me know how it goes!
      Regards,
      Bobby

      • It did work. Thank so much Bobby.

        Just one follow-up question.

        Is there a way to get free SSL certification for IP address (instead of domain as I don’t have domain associated with this droplet as I don’t want to buy an extra)? Otherwise, I was thinking to access it via a subdomain something like api.<domain>. as this droplet has my APIs (and front-end is hosted somewhere with the primary domain). What do you think is possible easily?

        • Hi there @suchakmaulik179,

          No problem at all! Happy to hear that it works!

          Yes, there are a few things that you could do:

          • If you want to use your IP address, you could generate a self signed certificate for your IP, though you would still get a warning in your browser.

          • If you do not get a new domain name, you could either:

            • Use a subdomain name as you suggested
            • Get a free domain name from Freenom

          Hope that this helps!
          Regards,
          Bobby

Submit an Answer