What is in config.php must match what's in DB for the moodle AND web service (assuming apache) must also respond to https:// (port 443) ... Cert should be a valid cert issued from a 'Certificate Authority' (CA) and not a self-signed cert.
Shared hosting provider cPanel's *might* have an app/icon for setting up Certs (SSL/TLS) for all domains set up by shared hosting package.
Plus, if you have a WordPress - code at web document root - and moodle not by another FQDN but in a /moodle/ directory under WP, WP .htaccess file rules would affect the moodle code as .htaccess rules are hierarchical ... affect all directories under them.
You can discover a lot using local machine and the curl command ... unless you have Windows workstation. If so, could use terminal on server:
curl -I https://yourmoodleurl
and
curl -I http://yourmoodleurl
Notice the diff? first one is https second is http.
Sent you a PM with a question ... please respond via PM.
'SoS', Ken