nativeInstallermoodle

Modify the default Moodle directory name and URL

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and Mac OS X) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). Learn more.

By default, Moodle is hosted at the /moodle URL, corresponding to the installdir/apps/moodle directory. To change this URL to a different path (for example, /mysite), follow these steps:

  • Edit the installdir/apps/moodle/conf/httpd-prefix.conf file and replace all instances of moodle with the new directory name. For example, to set the directory to mysite, edit the file contents so it looks like this:

    Alias /mysite/ "installdir/apps/moodle/htdocs/"
    Alias /mysite "installdir/apps/moodle/htdocs"
    Include "installdir/apps/moodle/conf/httpd-app.conf"
    
  • Edit the installdir/apps/moodle/htdocs/config.php and replace all instances of moodle with the new directory name. For example:

    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
        $CFG->wwwroot   = 'https://' . $_SERVER['HTTP_HOST'] . '/mysite';
    } else {
        $CFG->wwwroot   = 'http://' . $_SERVER['HTTP_HOST'] . '/mysite';
    };
    
  • Restart the server:

    $ sudo installdir/ctlscript.sh restart apache
    

You should now be able to access Moodle at the /mysite URL path.

Last modification September 4, 2018