Config.php - site url change - not working

Config.php - site url change - not working

by Adam Latrache -
Number of replies: 3

Hi all 


I have recently transferred our domain name to another sever on a shared hosting platform. The old moodle site URL no longer works. I have set up a subdomain in the new server and altered the A record to point to the old server (new server mysql dislikes moodle database from previous server) 

config.php changed to include the new site url. All other details are ok (db location, password, user) 

Moodle will not initiate. Any advice and guidance would be great. 

Steps taken in order:

1. Old server holds the moodle database and data folder. 

2. Transferred domain name to point to new server. (NS and A records point to new sever) 

3. Set up a subdomain in new server. 

4. Altered DNS A record for new subdomain to point to old server. 

5. Updated config.php file wwwroot with new subdomain. 

New site url = www.studentzone.sfe-academy.co.uk

Thank you. 

Average of ratings: -
In reply to Adam Latrache

Re: Config.php - site url change - not working

by Ken Task -
Picture of Particularly helpful Moodlers

If the DB server for the migrated site is on same server as code, the DB server host would be localhost or 127.0.0.1

If the fully qualified domain name (FQDN) of migrated site changed not only does one need to change wwwroot variable to new FQDN in config.php but also replace all the OLD url's contained in the DB for all internal links to the moodle.

One could do that by doing search and replace with a text editor (not word) on the sql file before importing into DB on new server, or, run search and replace tool ... https://site/admin/tool/httpsreplace/ or https://site/admin/tool/replace.

See: https://docs.moodle.org/39/en/Search_and_replace_tool

https://docs.moodle.org/39/en/Administration_via_command_line

CLI in particular:

https://docs.moodle.org/39/en/Administration_via_command_line#Search_and_replace_text

'SoS', Ken


In reply to Adam Latrache

Re: Config.php - site url change - not working

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

This might be due to the old server not recognising the domain name.

The web server looks in requests for the domain name (and port – HTTP or HTTPS) to know where to go for the site's files, i.e. the Moodle source code folder. E.g. https://moodle.example.com might go to one folder, https://www.studentzone.example.com to another folder, but these must be configured.

If the hosting service on the old server is tied to a specific, different domain name then what you're trying to do may not be possible. However, it may simply be a case of configuring the new subdomain+port on the old server and pointing it at the right folder.

But I think the problem is the web server configuration on the old server not with Moodle. If you're still stuck screenshots may help, crop or obscure anything you don't want to share on the Internet.

To confirm, from here I get a big "SORRY!" page using HTTP, with HTTPS I get a directory listing ("Index of /") for what looks like the files for another site.

In reply to Adam Latrache

Re: Config.php - site url change - not working

by Ken Task -
Picture of Particularly helpful Moodlers

Migrated from Shared hosting to Shared Hosting changing FQDN?

cPanel - Let's Encrypt ...

Using:
https://studentzone.sfe-academy.co.uk/


Websites prove their identity via certificates. Firefox does not trust this site because it uses a certificate that is not valid for studentzone.sfe-academy.co.uk. The certificate is only valid for the following names: cpanel.limitlessexpression.com, cpanel.petroleumclub.net, cpcalendars.limitlessexpression.com, cpcalendars.petroleumclub.net, cpcontacts.limitlessexpression.com, cpcontacts.petroleumclub.net, limitlessexpression.com, limitlessexpression.petroleumclub.net, mail.limitlessexpression.com, mail.petroleumclub.net, petroleumclub.net, webdisk.limitlessexpression.com, webdisk.petroleumclub.net, webmail.limitlessexpression.com, webmail.petroleumclub.net, www.limitlessexpression.com, www.limitlessexpression.petroleumclub.net, www.petroleumclub.net

Using:
https://www.studentzone.sfe-academy.co.uk/

get the same warning.

'SoS', Ken