There comes a time when the website you’ve built has grown to big or you’ve added some features to it that a shared type of hosting package simply cannot cope with.
The next step in these situations is to have the website moved over to a more powerful platform, in most cases this would be a VPS.
We will try to cover in this article all the aspects related to such a task and we will use as example a website hosted by 123-reg on their shared hosting platform which we will be moving to one of their VPSs.
Preparation
We will be moving the website files, the database, the mailboxes and finally have the domain name pointed to the VPS IP address via its DNS settings.
If everything is done right, there will be absolutely no downtime for the website or the e-mail services.
You need:
1) FTP access to your current hosting package;
2) Access to your current database;
3) The VPS to be up and running;
4) A subscription/account on your VPS for the new website;
5) FTP access to the above subscription/account
The process
Each hosting provider provides some type of automation for creating backups, both for the website files and the database, however, we will describe how to do this manually which we consider to be the safest way.
1) Copy all the website files onto your computer using an FTP client such as FileZilla (check: https://www.youtube.com/watch?v=Ag3tC1eYU6M)
2) Create a database backup using the tools your hosting provider offers for this purpose, most of them offer PhpMyAdmin and this is what we will be using in this example:
a) Once you’ve accessed/logged in to phpMyAdmin select the database your website uses:
b) Select “Export” from the top menu:
c) Configure the export (use the default settings if unsure):
d) Hit the “Go” button to create the .sql file:
123-reg specific shortcuts:
Backup the website files
Create database backup
Once you have the website files and the database dump on your computer we can move over to the VPS.
Plesk
If you’ve chosen Plesk as control panel for your VPS and your subscription has already been created we can get to work:
1) Upload your website files via FTP:
When creating the subscription, you have been asked to chose an username and a password. These are also the FTP details you will be using to upload your website.
Use any FTP client to access your VPS and upload the files into the httpdocs folder. I would recommend removing the existing files/folders you will find there.
3) Create a user for the database
4) Import the database content
5) Alter the wp-config.php file to match the new database connection details
After all these, you’re almost done. Use the Plesk website preview feature to check on your website or have the IP address of your VPS set as the default one for your website (if not already set this way) to simply access the website like this: http://ipaddress (eg http://192.168.1.15)
TROUBLESHOOTING
Fix the 404 errors
If while trying to browse your website almost all links are returning a 404 Not found error, go to your WordPress dashboard -> Settings -> Permalinks -> Save Changes (without actually changing anything).
What this will do is to have the .htaccess file regenerated.
Have a look at the Plesk settings for the preferred domain name: Subscriptions -> select subscription -> Open in control panel -> Hosting settings -> Preferred domain: select ‘none’.