A Moodle migration to a new hosting provider should move the application files, the moodledata directory, and the database as one planned process. A staged migration keeps the current site available while the new hosting environment is prepared and tested. Switch the domain only after the new Moodle copy is ready.
This sequence helps preserve course structures, enrolments, users, grades, file repositories, scheduled tasks, and Moodle-specific configuration while reducing the risk of data loss or extended downtime. A staged migration is also the recommended approach for moving a website without downtime.
Table of Contents
What must be moved
A Moodle site depends on more than its visible application files. The migration must include these three main parts:
- Moodle application files: the files that run the Moodle site.
moodledata: the directory used for Moodle file repositories and uploaded content.- The database: the data that contains courses, users, enrolments, grades, and other Moodle records.
Moodle-specific configuration must also be carried across. This includes the existing config.php settings and the configuration that supports scheduled tasks. Leaving out one of these parts can result in a site that loads but cannot show courses, user files, enrolments, grades, or scheduled activity correctly.
Prepare the new hosting environment
- Review the current Moodle installation. Record the locations of the Moodle application files, the
moodledatadirectory, the database,config.php, and the scheduled tasks used by the site. - Prepare the new hosting environment. Confirm that it can run the Moodle application and database used by the site. Plan the required PHP and database settings before transferring the site.
- Create the new site without changing the live domain. Keep the current Moodle site available while the new copy is built. The new environment must be tested before traffic is sent to it.
- Transfer the Moodle application files. Copy the application files to the new hosting environment while keeping their structure intact.
- Transfer the
moodledatadirectory. Copy the complete directory so that Moodle can continue to access course files and other stored content. - Transfer the database. Move the Moodle database to the new hosting environment. The database transfer is required to retain courses, users, enrolments, grades, and related Moodle data.
Update Moodle configuration and server settings
After the files and database are in place, update config.php for the new hosting environment. The configuration must refer to the new database connection, the new Moodle file location, and the new moodledata location where those values have changed.
Apply the PHP and database settings required by the Moodle installation on the new host. These settings are part of the migration because the application files and database must work together in the new environment. Keep the existing Moodle-specific configuration consistent unless a change is required by the new hosting setup.
Scheduled tasks must also be recreated or updated on the new host. Check that the tasks use the new Moodle file paths and the new hosting environment. A migration is not complete if the site opens but scheduled Moodle activity no longer runs.
Test the new Moodle site before switching DNS
Test the new copy while the existing site remains available. Use a controlled test path for the new environment and verify the parts of Moodle that depend on both the database and moodledata.
- Sign in with an administrator account.
- Authenticate with a standard user account.
- Open several courses and confirm that their structures are present.
- Check user enrolments and confirm that enrolled users can access the expected courses.
- Open course files and verify that file repositories load correctly.
- Review grades and confirm that existing grade data is available.
- Check that scheduled tasks are configured for the new environment.
- Confirm that the updated
config.php, PHP settings, and database settings allow Moodle to operate normally.
Testing authentication and file access is especially important. A site can appear available while users still cannot sign in or Moodle cannot find stored course files. Resolve these issues before changing the domain.
Switch DNS and keep a rollback plan
- Choose the cutover point. Switch only after the new Moodle site has passed the checks above.
- Point the domain to the new hosting environment. Change the DNS settings required for the domain to reach the new Moodle site.
- Keep the previous hosting environment available. It provides a rollback path while DNS changes take effect and the new site is observed.
- Monitor the new site after the switch. Check administrator and user authentication, course access, enrolments, grades, file repositories, and scheduled tasks again.
- Roll back if a critical problem appears. Point the domain back to the previous hosting environment while the issue is corrected on the new host. This is why the old site should remain available during the transition.
DNS propagation typically takes a few hours, although it can take longer depending on the domain registrar and network conditions. During this period, some users may reach the old environment while others reach the new one. Careful preparation before a server migration helps reduce the risk of downtime and data problems.
When the Moodle migration is complete
Consider the migration complete only when the new environment serves the domain and the Moodle data is intact. Courses, users, enrolments, grades, course files, authentication, and scheduled tasks should all work from the new host. Moving a website to a new server does not usually harm search engine ranking when the move is handled correctly, but the Moodle checks and DNS transition still need to be completed carefully. A server move does not usually negatively affect search engine ranking.