This happens outside of Moodle. In your web hosting interface you must set http://mysite.com to point to the ~/directory (where the config.php file is). This may be called web root, DocRoot or something similar.
With that you need to match $CFG->wwwroot = ' http://mysite.com'; in your config.php.
You need to clean up the URL in the Moodle database through https://mysite.com/admin/tool/replace/.
Installing and upgrading help
Moving moodle from directory to root
This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.