Publish: 2014-10-12 | Modify: 2018-10-10
Recently, Xiao Z's blog underwent a domain name change, which caused some damage to the website's vitality. However, the problems were quickly resolved. Here are some points to note during the domain name change, which will help in the website's recovery.
UPDATE wp_options SET option_value = replace( option_value, 'http://www.zouxiuping.com', 'http://www.xiaoz.me' ) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace( post_content, 'http://www.zouxiuping.com', 'http://www.xiaoz.me' ) ;
UPDATE wp_posts SET guid = replace( guid, 'http://www.zouxiuping.com', 'http://www.xiaoz.me' ) ;
Please execute the above statements one by one. Replace 'http://www.zouxiuping.com' with your old domain name and 'http://www.xiaoz.me' with your new domain name according to your domain name situation.
Use the SQL statement "SELECT * FROM wp_options
WHERE 1" to check if the siteurl and home fields are set to the new domain name. If they are, it means the update was successful. If not, please proceed to the next step.
This step is only for users whose database update was not successful. In wp-config.php, add the following two lines of code: (Replace 'http://www.xiaoz.me' with your new domain name)
define('WP_HOME','http://www.xiaoz.me');
define('WP_SITEURL','http://www.xiaoz.me');
Implementing permanent redirection (301 redirects) is a very important "automatic redirection" technique. It is the most feasible way to redirect all the links from your old domain to the new domain. For example, when accessing http://www.zouxiuping.com/archives/4739, it will automatically redirect to http://www.xiaoz.me/archives/4739.
Baidu suggests that after the new site has been online for a period of time and started to be indexed, you can use 301 redirects and notify search engines that the domain name has been changed. However, it takes some time for the search engines to process the notification. Google responds faster and has more comprehensive webmaster tools.
After changing the domain name, the backlinks to your old domain are still pointing to the old domain. Therefore, you should inform the other party about the situation and ask them to point the backlinks to the new domain. If the other party is unwilling, there is no need to force it. You can use this time to find new backlinks, which will help in the website's recovery.
The original tracking code cannot track the new website. Therefore, you need to obtain a new tracking code and add it. Common website tracking tools include Baidu Analytics, CNZZ Analytics, 51.la Free Analytics, etc. Each tool has its own features, so choose one that suits your needs.
These are the points to note during the domain name change. Feel free to add more suggestions, and if there are any inaccuracies, please correct them. ^_^
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.