{"id":685,"date":"2024-11-13T10:53:17","date_gmt":"2024-11-13T15:53:17","guid":{"rendered":"https:\/\/waterloobae.com\/?p=685"},"modified":"2025-08-20T14:24:40","modified_gmt":"2025-08-20T18:24:40","slug":"moodle-how-to-migrate-or-give-new-url-to-existing-moodle-site","status":"publish","type":"post","link":"https:\/\/waterloobae.com\/blog\/2024\/11\/13\/moodle-how-to-migrate-or-give-new-url-to-existing-moodle-site\/","title":{"rendered":"[Moodle] How to Migrate or Give new URL to existing Moodle site."},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I would like to list steps of how to migrate of give new URL to existing Moodle site when new URL is purchased or URL change are needed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">DNS record<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First, make it sure if new URL is pointing to the server where Moodle is serviced. You can look up how domain name is resolved by nslookup in CLI.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">%nslookup moodle.yoursite.com <\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Update config.php<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can find config.php from Moodle root directory and change the value of <br>$CFG-&gt;wwwroot to the new URL.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">$CFG-&gt;wwwroot   = 'https:\/\/moodle.yoursite.ca';<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Use Search and Replace tool<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to https:\/\/youroldsite.com\/admin\/tool\/replace\/ and use search and replace tool to replace old site URL to new one. It does not 100% guaranteed, but it worked for me. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"914\" height=\"1024\" src=\"https:\/\/waterloobae.com\/wp-content\/uploads\/2024\/11\/image-1-914x1024.png\" alt=\"\" class=\"wp-image-689\" srcset=\"https:\/\/waterloobae.com\/wp-content\/uploads\/2024\/11\/image-1-914x1024.png 914w, https:\/\/waterloobae.com\/wp-content\/uploads\/2024\/11\/image-1-268x300.png 268w, https:\/\/waterloobae.com\/wp-content\/uploads\/2024\/11\/image-1-768x860.png 768w, https:\/\/waterloobae.com\/wp-content\/uploads\/2024\/11\/image-1.png 1127w\" sizes=\"auto, (max-width: 914px) 100vw, 914px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Replace for any details<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">It is possible for you to see any links to images or icons are broken. When you see their URL it might be pointing out to the old site URL. You can use the tool above to replace those URLs. You have to be specific about your search and replace to include the whole links. Otherwise, it will replace too widely, that can cause malfunctioning of Moodle site. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I would like to list steps of how to migrate of give new URL to existing Moodle site when new URL is purchased or URL change are needed. DNS record First, make it sure if new URL is pointing to the server where Moodle is serviced. You can look up how domain name is resolved [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,19],"tags":[],"class_list":["post-685","post","type-post","status-publish","format-standard","hentry","category-it-tips","category-moddle"],"_links":{"self":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/posts\/685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/comments?post=685"}],"version-history":[{"count":7,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/posts\/685\/revisions"}],"predecessor-version":[{"id":693,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/posts\/685\/revisions\/693"}],"wp:attachment":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/media?parent=685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/categories?post=685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/tags?post=685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}