Last update at :2024-07-09,Edit by888u
Snail mentioned before that WordPress will be upgraded to the official version 5.2 in early May. If our server WEB environment is lower than PHP5.6, it will be incompatible. Therefore, many netizens back up their existing websites and upload them before starting to update the version. Reinstall the supported WEB environment version of the server. If some of our WEB systems support the installation of multiple versions of PHP and it is indeed easier to choose to switch. If we can only install a single version or want to redeploy the WEB environment, then we need to temporarily relocate the website and wait until the WEB is reinstalled on the server. Migrate back again.
At the same time, some of our webmasters want to migrate the data of a certain website to other servers or clone it to other websites, and change the domain name to copy the website. These types of operations can be classified as website backup and website relocation. I met a netizen before who usually backed up his website, but he only copied the files in the website directory and did not export the database. In the end, the server failed and could not be restored. Therefore, if you are a novice webmaster, you still need to read this article.
First, website backup and preparation before moving
1. Optional snapshot backup
If our server provider supports snapshot backup, we can snapshot the entire server, which is more direct and complete. If we make a mistake in the future, we can directly restore the snapshot to restore the system and data. If snapshot backup is not supported, then we need to perform manual backup.
2. Record the current server version
Some CMS programs require specific versions and software support, and we need to record them. For example, Snail met a netizen’s tool program before and needed to support ionCube and redis. In this way, when we deploy or relocate a new WEB environment later, we can directly deploy based on the necessary software. It would be a waste of time to wait until the migration fails and then debug each one.
3. New server installation environment
According to the software environment of the old server above, we need to configure the environment in the new server.
Second, back up the original server data
When we back up server data, we try to use service packaging, and then download it directly to the local or drag it to other servers for temporary management. I met a netizen whose root directory of the server contained 20GB of pictures, and he couldn’t drag it to the local area using FTP. The cloud server he purchased has a bandwidth of 1M, so it would probably take a long time. For this, we can package and use the intranet to transfer the data and migrate it to other servers (for example: using the Alibaba Cloud intranet to package and transfer larger files).
At the same time, we should not forget the database backup. If we have a MYSQL database, unlike the ASP website in the early years, the ACCESS database is directly in the root directory of the website. The MYSQL database is not in the root directory. We need to export the database. For database export, if the database is relatively small, we can use the phpmyadmin tool to export. If it is larger, it is recommended to directly use mysqldump backup and export, which is more complete.
Or some of our users are accustomed to using tools like Empire Backup King to back up their websites, which is also acceptable. But when Snail helped a netizen restore his website before, Imperial Backup King seemed to be unable to restore it under certain circumstances. Therefore, I suggest that if it is a particularly important website, we should back it up in multiple ways so that we can choose a restore method in case of failure. It’s not like none of them are easy to restore.
Third, migrate data to the new server environment
Here we migrate the data to the new server, this snail is not cumbersome, add the site and database, decompress the root directory of the website file, and import the database. After that, we modify the domain name resolution or some things that are not website functions and see if the software environment is compatible. If there is no problem with compatibility and the new server can fully operate, we can delete the data of the old server or reinstall the system.
If our website is not that important, we can close it and make it inaccessible in a short period of time. After ensuring that there is no problem with the backup, we can reconfigure the system environment of the server and restore the website data.
Fourth, if you are relocating and changing the domain name
If we need to use the data of a certain website and just want to change the domain name of the website, we need to modify the domain name of the website after migrating to the new website. For the WordPress program, we need to modify the two URLs in the wp_options table in the database.
Here we modify the siteurl and home URLs to new URLs. At the same time, we need to replace the original URLs in the website content in batches. Here we directly use the plug-in and the latter is a direct mysql script.
UPDATE wp_posts SET post_content = REPLACE( post_content, \\’Original content\\’, \\’New content\\’ ) ;
Just replace it if it is more practical.
UPDATE wp_posts SET post_content = REPLACE( post_content, \\’www.laozuo.org\\’, \\’www.laobuluo.com\\’ ) ;
At the same time, we also need to pay attention to the prefix of our table in the red part. Finally, if we have a fixed URL in the website theme, we need to modify the template.
In this way, through the above steps, we can completely migrate the website to a new server or change the website domain name. The most critical part here is to back up the website data. Only after ensuring that there are no problems can the data in the original server be deleted.
Recommended site searches: expired domain name query, Ministry of Industry and Information Technology website registration query, US domain name, high-defense server rental, IP purchase, forum registration, domain name provider, foreign domain name, multi-IP station group server, Taiwan server rental,
发表评论