After moving a WordPress site, wp-admin redirects to old site?

Recently, I had to move one of my WordPress projects, from my development server to the client’s server. So what I did was, I copied the database and all the files, created a new database and imported the old one. I then changed the wp-config file accordingly.

Now home page works pretty fine, however I noticed all the routes are still being set to old URLs when I tried to login to the backend. When I typed mynewsite.com/wp-admin it took me to the login page of my development server (myoldsite.com/wp-admin)

I tried several methods to overcome this issue. First I manually replaced all the routes in my database with the new URLs but it broke most of the functionalities. Next, I tried using Search Replace DB script, however since my client’s server was a shared one it threw an AJAX error. I also tried typing mynewsite/wp_login.php which took me to the login page of my new site, still when I enter the credentials and login it routed back to my old site.

Luckily, I found the same question answered on Stack Overflow. And the solution was pretty straight forward and easy.

All you got to do is login to PHPMyAdmin and go to wp_options table set homeurl and siteurl as your new URL. This will fix your routes to work properly. Once you are logged in to the back-end dashboard go to Setting-> General and check whether the WordPress Address (URL) and Site Address (URL) is set properly.

Leave your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: