admin管理员组

文章数量:1290979

My site’s domain name was originally devsite, last week I changed it to productsite on my virtual server( managed by virtualmin). I have also changed the setting and updated the database. I believe I have changed all occurences of “devsite” in the database to “productsite”. I am not sure if there is cache somewhere but one week has passed and when I open productsite in my browser, it still goes to devsite and open the default server in this IP. But if I get into incognito mode or open it with another browser, this problem will be no more. Not a big deal cause it doesn’t affect my users but it is quite bothering for me cause every time I had to use incognito mode to access my own site, also there might also be some potential problems somewhere.

I am not sure if this is a wordpress problem or a virtualmin problem, so I will also post this question to virtualmin forum.

My site’s domain name was originally devsite, last week I changed it to productsite on my virtual server( managed by virtualmin). I have also changed the setting and updated the database. I believe I have changed all occurences of “devsite” in the database to “productsite”. I am not sure if there is cache somewhere but one week has passed and when I open productsite in my browser, it still goes to devsite and open the default server in this IP. But if I get into incognito mode or open it with another browser, this problem will be no more. Not a big deal cause it doesn’t affect my users but it is quite bothering for me cause every time I had to use incognito mode to access my own site, also there might also be some potential problems somewhere.

I am not sure if this is a wordpress problem or a virtualmin problem, so I will also post this question to virtualmin forum.

Share Improve this question asked Jun 12, 2021 at 11:59 shenkwenshenkwen 1311 silver badge9 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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' );
define( 'WP_SITEURL', 'https://productsite' );

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' 'productsite' --skip-columns=guid
wp option update home 'http://productsite'
wp option update siteurl 'http://productsite'

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.

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

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/

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

本文标签: serverChanging domain name causes some strange problem in my browser