Migrating your Moodle site to a new server or domain

Updated

Migrating Moodle between domains

If you are only changing domains (and not migrating servers), all you need to do is open the config.php file in the Moodle root directory, and change the "wwwroot" line to reflect the new domain.

Then, login to Moodle and go to Site administration > Development > Purge caches > Purge all caches.

Migrating Moodle between directories on the same server

If you're only migrating directories on the server, all you need to do is move the files in the Moodle root directory to the new location, and then modify the config.php file to reflect the new paths for "dataroot" and "wwwroot".

After that, remember to purge the Moodle caches as explained above.

Migrating your entire Moodle site to a new server

To do a full migration between servers, here's what you will need to do:  

  1. Move the entire Moodle root folder from the old server to the new server, and modify the config.php file with the new database details and server paths, and the new domain name if necessary  
  2. Move the entire moodledata folder from the old server to the new server (make sure to change the server paths in the config.php file in the Moodle root folder)  
  3. Export the entire MySQL database from the old server (via phpmyadmin for example), and import the database into a new/empty database on the new server. 

Make sure to specify the new database details in the config.php file in the Moodle root. 

That's all you'll need to do.

Lastly, log into the Moodle site on the new server, go to Site administration > Development > Purge Caches and purge all caches.