Back to blog
May 23, 2026Guides

How to Migrate a Website to a New VPS

Complete migration guide: backup files and database, transfer to Hiddence VPS, update DNS, and verify the site.

How to Migrate a Website to a New VPS

Moving a website to a new VPS — whether from shared hosting or an old server — requires copying files, databases, and updating DNS. Follow this checklist to minimize downtime on your Hiddence server.

Before you start

  • Provision the new VPS with the same or newer OS/PHP/MySQL versions
  • Install web stack (Nginx/Apache, PHP, MySQL/MariaDB)
  • Note current DNS TTL and lower it to 300 a day before migration
  • Create full backup of old server
  • Inform users about possible short maintenance window

Step 1: Backup website files

On the old server, archive the site directory:

bash
cd /var/www
tar -czvf website-backup.tar.gz yoursite/

# Download to your computer:
scp user@old-server:/var/www/website-backup.tar.gz .

Step 2: Upload to new VPS

Copy the archive to your Hiddence server and extract:

bash
scp website-backup.tar.gz root@NEW_VPS_IP:/var/www/
ssh root@NEW_VPS_IP
cd /var/www
tar -xzvf website-backup.tar.gz
chown -R www-data:www-data yoursite/

Step 3: Migrate MySQL database

Export on old server, import on new:

bash
# On old server:
mysqldump -u root -p database_name > db.sql

# Copy and import on new VPS:
scp db.sql root@NEW_VPS_IP:/tmp/
mysql -u root -p -e "CREATE DATABASE database_name;"
mysql -u root -p database_name < /tmp/db.sql

# Update wp-config.php or app .env with new DB credentials if needed

Step 4: Switch DNS

When the site works on the new IP (test via /etc/hosts or temporary URL), update DNS A record to the new VPS IP. Wait for propagation and verify:

  • Site opens on domain without errors
  • HTTPS certificate is valid (re-issue Certbot if needed)
  • Forms and login work (database connection OK)
  • Cron jobs and email sending work
  • Keep old server online 24–48 hours as fallback

Migration tips

  • Use rsync for large sites: rsync -avz old:/var/www/site/ new:/var/www/site/
  • Match PHP version to avoid compatibility issues
  • Test with hosts file: echo "NEW_IP yourdomain.com" >> /etc/hosts
  • Flush Redis/Memcached cache after migration
  • Run search-replace on URLs in WordPress if domain changed