This article describes how to change the site URL for a Moodle installation. You may need to do this, for example, if you migrate an existing Moodle installation to a new server. Alternatively, you may want to relocate a Moodle installation to a new directory on the same server.
To change the site URL for a Moodle installation, follow these steps:
$CFG->wwwroot = 'https://example.com/moodle';
Save your changes to the config.php file. The new site URL is now active.
If you are migrating a Moodle installation, you should check other values in the config.php file and ensure they are correct. For example, verify that the following database and data directory settings are correct:
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.