Since you have restored only 2 courses and I assume students have not been in those due to site config issues, WIPE it out ... do it again ... only this time you are aware of where you want to go and can avoid the issues.
In hind sight ... always easier when you do it right the first time ... so begin with end in mind: a site using a fqdn ... which you know ... a site using https ... for which you have a valid cert.
OR ... if you are stubborn ... and have the time to reverse engineer/fix mistakes, suggest (note I've not seen exactly what you did so this is 'best guess") the following:
Tutorial didn't really get into information about the location of document root
the folder from which apache would look to serve out whatever is there.
One way round issue: set document root in apache2.conf file to include /moodle/ and then you don't need to move files.
cd into /etc/apache2 directory is there a apache2.conf file?
edit that and look for DocumentRoot
Probably show now as DocumentRoot /var/www/html
Simply add /moodle to the end of that.
Now when you go to your site / no subdirectory, Moodle should show.
Still need to do search and replace.
But by now that might be a little messed up.
So, do a backup of the DB - a mysqldump.
Edit the dumped .sql file with nano and search for:
There also might be some
https://IPaddress/moodle/ in there.
Nano has search and replace so search for what changes you need to make
to get what is in config.php file of Moodle which should have
https://FQDN ... note no trailing slash
Search for and replace
All the above now need to be: https://fqdn/
After you;'ve edited the mysqldump, file is called whatever you named it.
Let's say you named it mdlbackup.sql
Create a new database for the moodle.
Step 2.3 Create Database in the tutorial
cept you don't need a DB user ... you have that already
CREATE DATABASE newmoodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
exit the mysql client.
Now import the edited .sql file into the database called 'newmoodle'.
mysql -u root -pPASSWORD newmoodle < mdlbackup.sql
Now edit config.php and for the DB name use the 'newmoodle' database. The wwwroot url should be https://fqdn with no trailing slash.
To be 100% honest ... I'd start over ... not much time as been invested yet and reverse engineering is the more difficult road to go.