Quick code#
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{REQUEST_FILENAME} !/maintenance.html
RewriteRule ^.*$ /maintenance.html [L]
Migration workflow#
- Reduce DNS TTL to 5 minutes
- Configure destination server matching source settings
- Prepare maintenance rules in source vhost
- Execute initial database dumps and rsync transfers
- Verify functionality via modified hosts file
- Perform intermediate and final database/file syncs
- Create maintenance page on source
- Switch DNS to destination IP
Example commands#
mysqldump --routines -uroot -p database1 > /root/dumps/database1.sql
rsync -aHvx --numeric-ids --progress root@sourceServer:/var/www/website/ /var/www/website/
mysql -uroot -p database1 < /root/dumps/database1.sql