localhost is redirected to localhost/localhost

Re: localhost is redirected to localhost/localhost

by v k -
Number of replies: 1
If I add test.php with the simple <?php phpinfo(); > to localhost ( = C\inetpub\wwwroot) and then  navigate to localhost/test.php - it works fine and phpinfo page is displayed.


So what might be the problem with:

  • navigating to localhost is redirected to localhost/localhost and caused 404
  • navigating to localhost/install.php is redirected to localhost/admin/localhost and causes 404 as well

what should I check?

In reply to v k

Re: localhost is redirected to localhost/localhost

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

My best guess would be that you've got an existing config.php in the top level of your Moodle source code folder and this has the following line with the location you're being incorrectly redirected to:

$CFG->wwwroot = 'http://localhost/localhost';

You probably need to change this to:

$CFG->wwwroot = 'http://localhost';

File config.php is probably in C:\inetpub\wwwroot.

However, you wouldn't normally have an existing config.php (the file containing key configuration information about your site) before you've installed Moodle unless you've either manually created this or have already tried to install Moodle unsuccessfully.