How to transfer a site to another hosting or tariff yourself remotely, without downloading to a computer
The site may need to be transferred at any time to another tariff or hosting. For this, technical support is often involved, but it may refuse or respond for a long time, not to mention the transfer speed itself. Therefore, you need to perform migration of the site yourself.
To do this, first you need to archive the site files, a ZIP archive will do. You can use hosting tools, or you can use SSH. Creating such an archive is easy, you can use the SSH command:
zip -r archive-name.zip /folder-path
After that, you can download the archive to your PC, but in order not to waste traffic and not wait a long time for downloading, and then uploading to a new hosting, you can use remote transfer from one server to another. There is an SSH command for this:
In order to use this command, you need to SSH into the destination host and run it. But first you need to move the resulting archive on the source hosting to the site folder so that you can download it from the URL. For security purposes, it is better to name the archive with a random set of characters so that no one can download your site by accident. As soon as the archive is downloaded, the archive must be immediately removed from the site directory. After that, on the final hosting, you need to unzip:
It remains to transfer the database remotely, for this there is the mysqldump utility, the SSH command with archiving:
mysqldump -u username -puserpassword dbname | gzip > path-to-target-file.sql.gz
The password is not indented from the p parameter. After that, the resulting archive is moved to the site folder and downloaded in the same way as site files using the wget utility. It is important to use random names and do not forget to delete the archive in the root of the site after the operation is completed.
Next, the resulting dump is loaded into a new database on the final hosting using the SSH command:
gunzip < path-to-dump-file.sql.gz | mysqldump -u username -puserpassword dbname
It remains only to check the integrity of the files and delete the old hosting service, and update the database connection settings on the new one if necessary. You may also need to transfer the SSL certificate and perform other settings with adding, setting up a domain, etc. It won't take long, you can skip the update of DNS records for the domain and use VPN, for example, in the Opera browser - to quickly check the site's performance on a new hosting.
- 09.07.22IT / Misc Convert office files DOC, DOCX, DOCM, RTF to DOCX, DOCM, DOC, RTF, PDF, HTML, XML, TXT formats without loss and markup changes
- 07.07.22IT / Safety How to protect PHP, JS, HTML, CSS source code - obfuscation, minification, compression and encryption
- 06.07.22IT / Safety Connection not secure, problem with Lets Encrypt - how to fix expired 09/30/2021 DST Root CA X3, remove it manually and install ISRG Root X1. Example on MS Windows 7
- 08.07.21IT / Misc How to make a free translation for a website without an API, translate documents in Google Translate
- 06.07.21IT / Misc How to make a subscription button on a website, a subscriber base and automatic mailing