Moving a Wordpress site is actually quite simple, involving just two steps: one for backup and the other for restoration. However, there are two scenarios to consider: either you're changing the domain name or you're only changing the hosting space without altering the domain.
If you're not changing the domain, moving the site presents no difficulty. You simply copy all the files from the current directory to the corresponding directory on the new hosting space and import the database, and that's it. Therefore, this guide will focus on the situation where you're changing the domain.
Here’s the entire process:
Changing the domain means that if your blog posts contain links using the original directory structure, all these links will become invalid on the new blog. Of course, nobody wants that, so you need to make changes in the database to replace the old links with new ones. How do you do that?
Method 1: Directly use the 'replace' command in the MySQL backend to substitute the new domain for the old one. This method requires knowledge of MySQL commands. I'm a novice and don't understand MySQL commands, so I would appreciate it if someone could explain how to do it.
Method 2: Use Wordpress's built-in database backup plugin to back up the entire database to your local hard drive. Open the local database with a text editor like Notepad++ and then directly use the Find & Replace function.
Next, search for "DEFAULT CHARSET=latin1" and replace it with "DEFAULT CHARSET=utf8".
Now that the database has been modified, we need to import the data into the new database. Open phpMyAdmin, create a new database, then under Operations -> Collation, change the encoding to "utf8_general_ci". Then use the Import option to import the modified database into the new one.
Next, update the default domain. Open the wp-options table, browse it, and replace the values of the 'siteurl' and 'home' variables with the new domain.
The next step is to open wp-config.php and update the parameters (database name, user, password).
Then, you can copy all the files from your original blog to the corresponding directories of the new domain. After copying, open your new blog page, and voila!... You might see all the article content changed to question marks (???). Don't worry, there's still one key step left. Open wp-includes/wp-db.php and modify: $this->dbh = @mysql_connect($dbhost,$dbuser,$dbpassword);
// Add the following line
$this->query("SET NAMES 'utf8'");
Save, exit, and now opening the page should work fine.
Oh, if you see garbled characters along with errors such as "undefined function cannot be used," go to the Wordpress admin panel and activate the plugins you were previously using.
Finally, one more tip: If you want to avoid any interruption in access to your blog, it's best to activate the new domain beforehand and confirm that it has propagated across the entire internet before moving. Otherwise, some readers may temporarily be unable to access your new address.
Update: Based on Albert's experience, to avoid differences in database structures between different versions of WP, it's best to ensure that both the old and new sites are running the same version of Wordpress before moving.
This article comes from '哓峯豆糠Sharefo.com' http://sharefo.com, original link: http://sharefo.com/index.php/archives/84.html