Website Migrations #
Posted 03rd October, 2018
The Fixed.net Migration Service professionally moves your website from one location to another. This can include:
- Moving an active website from an old host to a new web host
- Moving a website under development in a staging environment to an active website
- Duplicating a live site to another domain in another location
- Moving around multiple websites within one space
- We can also change the domain on an existing website
Migrate my website!
A website migration is, in theory, relatively straightforward. Most websites, including Wordpress, Joomla and Magento, are built using a set of files and a single database. In order to migrate a website, the following things need to be done.
- Download the files from the old location and Upload them to the new location.
- Export the database from the old location and import it to the new location.
- Update the configuration file to point to the new database.
- Update the Domain DNS to point to the new hosting IP Address
Moving Files #
You must connect to the old provider using a file connection method such as FTP or SSH. These files then need to be uploaded to the new provider.
Advanced users can move files directly from the old provider to the new, using rsync or scp. These cut out the need to download files to a local machine first.
Moving Databases #
MySQL Databases #
MySQL databases can be moved by exporting the file as an .sql dump. A mysql dump can be run on the command line as follows:
mysqldump -h hostname -u username -p databasename > filename.sql
Ensure that the .sql file is not placed anywhere world readable or downloadable.
This resulting .sql file can then be moved to the new server and imported as follows:
mysql -h hostname -u username -p databasename < filename.sql
Note that you will need to have created a new blank database, username and password on the new server first.
Using PHPMyAdmin #
Alternatively, software such as PHPMyAdmin provides a graphical user interface for managing database exports and imports. To export a database:
- Log into PHPMyAdmin.
- Click your database name on the left.
- Click the
Export Structure and Dataand
Export to file
This will download an .sql file to your computer. To import it:
- Ensure a new database is created with your new host and that a user is added with all privilieges.
- Open PHPMyAdmin and select your new database name on the left.
- Click the
- Select your file and click
Common Issues #
- DNS Caching
- Character Encoding
- Website Caching
- Different PHP Versions
- Export timing out
- If there is an export or import time out, you have likely hit a system limit here. If you are using PHPMyAdmin, this could be a php memory or execution time limit. If this is a global PHPMyAdmin (i.e. not installed on your own web space) you should ask your host to increase these limits, try importing using the command line or you could break the export and import into constituent tables, or exclude a table from the backup and import it separately.
Previewing a Migrated Website #
Sometimes you may want to check your website is running correctly in the new location before updating your DNS and pointing your website. The best way to do that is to set a hosts file which fools your computer into thinking the site is live. This is what we do when we migrate a site, and we can also help you to test it.
Alternatively there may be ways we can set up a temporary URL for you to preview your website. Some web hosts have this functionality.
Ecommerce Websites / Data Consistency #
For most websites, content does not change too frequently. That means if you migrate a website, the new location is likely to show the same as the old website, and a DNS change, which might take 12 hours, does not matter to you or your website visitors.
But what happens if you make frequent changes, or you run an online e-commerce store? If the site is migrated, and an order is made shortly after – that order could be lost with the old website database. In cases like these we can perform a more complex migration.
One option is to turn on ‘maintenance mode’
The files on a new server can be connected to a database on the old server