ElearningWorld.org

For the online learning world

MoodleTechnical

Changing your Moodle site name? Then read this!

Changing your Moodle site name isn’t quite as easy as it sounds…

We’ve seen quite a few questions about this topic on Moodle.org community forums recently.

Let’s say you have a Moodle site running on https://www.mymoodlesite.com, but you want to change that to a subdomain of your main company such as https://learning.mycompany.com.

Or you might be repositioning your site in a more community or international market, and wanting to go from https://www.mymoodlesite.co.uk to https://www.mymoodlesite.org, or https://www.mymoodlesite.info.

Any web administrator will know that the first thing to do is change the web server setup – so a typical scenario is to edit the Apache Web Server conf files to reference the new address. That might be enough for many website, but not for Moodle!

Moodle, somewhat unusually, uses absolute references in it’s database. So that means if you change the Moodle site name, the internal links in Moodle will break. The site will still operate, but you will get lots of errors such as images not loading, and errors messages when clicking on activities.

However, there is a simple answer that administrator can use!

Admins can use the Search and Replace script detailed on this page:

https://docs.moodle.org/36/en/Search_and_replace_tool

It’s easy for an administrator to call this script directly from Moodle GUI, once you know where it is 😉

There is also a command line version for those administrators happier on the CLI.

But be warned, there is no “Undo” feature here.

This script is issuing direct UPDATE statements in the Moodle database to search and replace the old name and new name.

It is VITAL that you make a backup of the database first, AND that you know how to restore this database if something goes wrong.

I’ve used this script maybe a dozen times over the years. It’s always worked well, apart from once, but that archive Moodle server already had many problems (running on Windows and Microsoft SQL being two of them! lol).

Stuart Mealor
Latest posts by Stuart Mealor (see all)

Stuart Mealor

Stuart is interested in all things e-learning, with specific interests in Moodle, e-learning strategy, and business development. His experience in education over 30 years, MBA in International Business, and knowledge of e-learning systems implementation, together with graphic design background, give him a unique skill set for e-learning projects.

Add a reply or comment...