How do I move a website?
Back to web hostingIt is possible to move a website from one server to another.
This can be useful, for example, if you are moving provider or control panel.
For this you need some things to get started:
- The files of the website
- An export of the database (in .sql format)
The website files can be retrieved via FTP on the old environment.
An export of the database can be performed through a function on the control panel.
Alternatively, the database export may be delivered in the form of a .sql.gz.
This file can be opened with winrar, and from here the .sql file can be extracted.
To import the website on the new environment, upload the files with FTP to the new environment.
When importing the database, things can get a little tricky.
For this you need to create a database in the control panel used here.
After creating the database, you can import the export.
This can be done with a database up to 160 MB by uploading it directly into PHPmyadmin.
A database export up to 1 GB can also be uploaded via FTP in imported with the following steps:
- Log in to PHPmyadmin via: domainname.com/phpmyadmin
The data requested are those of the database just created. - Navigate left to the database that has just been created.
- Click Import at the top, here you can make the above choice to upload the database directly.
Or you can specify here a path to the file uploaded with FTP.
If the database is larger than 1 GB an alternative way will have to be performed.
This is because PHPmyadmin runs into a timeout when trying to import.
For this you need SSH access and the .sql file must be uploaded via FTP.
After this, log into SSH and navigate to the same directory where the file is located and run the following command:
"mysql -u{username database} -p {database} < exportfile.sql".
This will import the file into the named database.
The last step is to make sure that the website takes over the database correctly?
Often this is taken care of in a file on the website, for example with wordpress this is the "wp-config.php" file.
This is where the new database information must be entered to make the connection.
How this is set up can vary from website to website.