How does WordPress replace domainname?

Open a personal blog friends use WordPress a few, then it is inevitable that the replacement of space and domain name, because the author experienced a replacement space and domain name, the blog changed from AAA.com to BBB.com, so this article to share Replace the domain name better way.
WordPress we all know that the background needs to set the site’s default URL, if the direct replacement of the domain name, then use the new domain name is unable to login. There are many articles on the Internet, tell you can modify the MySQL database, or modify the WordPress wp-config.php file or function.php file, in fact, not so much trouble.
As long as the replacement before and after the domain name in their own hands, then the solution is very simple. First change the domain name before and after the analysis are resolved to the blog space, that is, so that the old and new domain name can correctly access the blog. To determine whether the old and new domain name can be properly accessed, in addition to their own local direct access to the two domain names can be properly accessed to the site, but also need to see other areas of domain name access is normal, because Telecom, China Unicom, there are different areas of DNS effective time is different of. At this time the station owners have a good tool, but the use of super ping (http://ping.chinaz.com), the old and new domain names were entered into the super ping, to see whether all over the ping .
If you determine the old and new domain names are parsed after the normal, you can change the domain name, and in a word called witness the miracle of the moment.
With the administrator login WordPress background, click Settings → General, inside the WordPress address (URL) and site address (URL) are modified to a new domain name, and then click Save Changes. Hey, ye quit, in fact, is a success, look at the browser’s address bar is not a new address? Log in with the administrator account, look at the settings → routine is not a new domain name? And then click on the home page to see if it is not a new domain name, if you enter the old domain name will not jump to the new domain name It is clear that the change is successful, is not very simple.
But because of the blog article in some of the links and picture address or use the old domain name, so also need to make some changes.
Login phpmyadmin, select your own database of the blog, and then click SQL, enter the following three lines of command:
UPDATE wp_posts SET post_content = replace (post_content, ‘AAA.com’, ‘BBB.com’);
UPDATE wp_comments SET comment_content = replace (comment_content, ‘AAA.com’, ‘BBB.com’);
UPDATE wp_comments SET comment_author_url = replace (comment_author_url, ‘AAA.com’, ‘BBB.com’);
And then click on the implementation, if there is no error, then the article and the comments will be replaced in all the addresses.
This time with a new address to visit it, the domain name to replace the perfect.