The solution to the blog access error caused by changing the domain name of the WorldPress blog system

In the blog system generated based on wordpress, when the original domain name of the blog is replaced with a new domain name, when visiting the new domain name address, the following problems are found:

  1. The page style of the blog is out of order;
  2. Visit the management background of the blog and find that the program automatically jumps to the jump-out link based on the old domain name, which makes it impossible to log in to the console

Problem analysis:
After checking the online information, it is found that the reason for this problem is that worldpress will store the domain name information used in part of the logic in the database, which leads to the fact that although our domain name resolution has completed the switching mapping of the new domain name, the worldpress program Without knowing this, the internal program will still access the old domain name stored in the database

Solution:
According to the analysis results, the solution is also very simple. We just need to update all the old domain names stored in the database to new domain names. The specific operations are as follows:

Use database software to connect to the database corresponding to the blog, and enter and execute the following statement

**Note: ** Replace
in the following statement 'http://www.old.com',with your original blog domain name Replace
in the following statement 'http://www.new.com',with your blog's new domain name

UPDATE wp_options SET option_value = 'http://www.new.com' WHERE option_name = 'home' OR option_name = 'siteurl'; 
 
UPDATE wp_posts SET post_content = replace( post_content, 'http://www.old.com', 'http://www.new.com' ) ;  

UPDATE wp_posts SET guid = replace( guid, 'http://www.old.com', 'http://www.new.com' ) ;  

After the operation is complete, refresh the page access test and find that the problem has been perfectly solved

Guess you like

Origin blog.csdn.net/SMDOUSM/article/details/124220447
Recommended