Wordpress - Redirecting to old domain after migration

My issue is resolved, I am posting this as an answer so that someone else can benefit out of it.

My issue was, siteurl and homeurl were not updated, so I have placed define('RELOCATE',true); in my wp-config.php file. And again tried to access the website , it gone to the correct URL but all the CSS was gone.
Then I headed over to wp-admin and it also came with no CSS but still I tried to login but this time it has taken me to the correct URL and with CSS login page but didn't log in. Then again I attempted to login and this time I was successful. Then I changed both the URLs from settings in the admin panel.

After this you must to delete all your browser cache files to delete any kind of persistent redirection.

Hope this helps someone else dealing with the same problem.


I had the same problem (works fine now), here is what i done

instead of try to access to the admin panel whit yoursite.com/wp-admin i tried with yoursite.com/wp-login.php and it took me to the admin panel of my new site. Then I changed the site domain in general settings and now it works just fine.


Run the following when you are changing domain:

UPDATE wp_options SET option_value = 'https://yournew.domain' WHERE option_name = 'siteurl';
UPDATE wp_options SET option_value = 'https://yournew.domain' WHERE option_name = 'home';