Migrating a drupal site to different hosting
(No, these instructions have nothing to do with "no downtime" or live site migration, if you need that then you need a professional.)
Theoretically you can put your site in Offline/Maintenance mode to ensure nothing new gets put in while you do the backup process (until the new one is online) but if you're in a Disaster Recovery then you might be using an older backup anyways.
FILES
-
Download the folder with your Drupal install files (and hopefully any config files).
-
Upload files/folder into a new subfolder in your new host's multi domain installation (e.g. public_html/migratingsiteNAME to have public_html/migratingsiteNAME/index.php)
DATABASE
-
Database to backup, hopefully your CPANEL has a backup option that will export your databases (if you go with "Partial Backup" you can do one at a time).
-
Otherwise you'll be using phpMyAdmin export or mysql --dump commands
Compression into .tar and .gzip (aka tar.gz) will speed download/upload but you might want 7zip to extract the .sql file...
http://kittyandbear.net/john/web-tutorials/drupal/drupal-backing-up-and-restoring.txt
CPANEL FROM THE NEW HOSTING COMPANY
Create the new database (almost the same name - except webhosts enforce unique database names by prefixing the username_databasename and I have different users...)
I've also created a test subdomain (mapped to the document root we created at #2) e.g. testmigrate
If you're migrating multiple subdomain Drupal installations like me then you'll have to re-create every subdomain (once the main domain has been added as an "addon domain").
MODIFYING THE CONFIGURATION FILES
-
Use Filezilla -> right click -> file permissions or SSH chmod 644 on settings.php
-
Then nano or notepad to modify: public_html/testmigrate/sites/default/settings.php with new DB username and password
Note that sometimes they use localhost, but MySQL may be on a different server
$db_url = 'mysql://HOSTUSER_DBUSER:password@localhost/HOSTUSER_DBNAME';
$db_url = 'mysql://kbdrupaluser:PASSWORD@10.6.166.225/kbdrupaluser';
-
Set file permissions back to read only for (chmod 444) settings.php
-
cron jobs will need to be recreated.
TROUBLESHOOTING
- You may also want to check your .htaccess file e.g. at the end
RewriteCond %{HTTP_REFERER} !^http://testmigrate.DOMAIN.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://testmigrate.DOMAIN.com$ [NC]
- http://example.com/index.php?q=admin/settings/clean-urls and disable clean urls to gain access to your new site; then you can enable clean urls in a manner that your new host supports.