Changing domain name causes some strange problem in my browser

There are a few things that could cause this. Most likely this is something that is cached somewhere, so start with clearing the cache properly.

Clear the cache in your browser

If you are using chrome, open the devtools, open the “Application” tab and click “Clear site data”.

Chrome also caches http redirects etc, but if you keep your devtools open, it’s going to read the actual response from the server. So, with devtools open, do a hard reload ++R.

Check the redirect rules on your server

Make sure that there are no rules in your web server configuration file that is causing this redirect.

  • If you are running Apache, look in the sites .htaccess.
  • If you are running nginx, check the sites config file.

Overwrite any config

See if the problem goes away if you overwrite any settings with hard-coded settings.

Add the following to your functions.php

define( 'WP_HOME', 'https://productsite.com' );
define( 'WP_SITEURL', 'https://productsite.com' );

If you have access to the terminal, you can use wp-cli to update the settings there. Also, just to be sure, run the serach-replace here as well:

wp search-replace 'devsite.com' 'productsite.com' --skip-columns=guid
wp option update home 'http://productsite.com'
wp option update siteurl 'http://productsite.com'

If you don’t have access to the terminal, you can do this serach replace using a plugin called Better Search Replace.

More info

A good read is the article Moving WordPress on WordPress.org.

If you want to try to find out what’s going on, you can look in the devtools in the Network-tab. Check the option “Preserve log”, and go to the url you get redirected from. Click the first response you got, and look at the headers. They will give you a hint on why you got redirected.

If you have access to a terminal, you can just do:

curl -I https://productsite.com

It would give you something like:

HTTP/1.1 301 Moved Permanently
Date: Sat, 12 Jun 2021 14:09:27 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://devsite.com/

If this one is redirecting you, you need to keep looking for the problem.