Moodle 1.9 directory twice in the path.

Moodle 1.9 directory twice in the path.

by Hassan Bourhrous -
Number of replies: 6

Newbie to moodle trying to add users and getting the error:

The requested URL /X/X/user/editadvanced.php was not found on this server, where the X is my moodle directory. Any ideas why does it take the directory X twice in the path thus taking the wrong the path to the php script?

Same problem with adding courses.

Much appreciated!

Average of ratings: -
In reply to Hassan Bourhrous

Re: Moodle 1.9 directory twice in the path.

by Colin Fraser -
Picture of Documentation writers Picture of Testers

This is unusual... not sure I have run into this before. However, can you access the Moodle root folder on your server?

If you can then look for the file config.php. 

You should find two lines that should read something like:

$CFG->wwwroot   = 'http://xxx.xxx.xxx.xxx/moodle';
$CFG->dirroot  = 'c:/absolute/path/to/server/moodle';

Chances are one, or both, of them are reading

$CFG->wwwroot   = 'http://xxx.xxx.xxx.xxx/moodle/moodle';
$CFG->dirroot  = 'c:/absolute/path/to/server/moodle/moodle';

Or as you have put it here /X/X/, whatever that stands for.

Open the file for editing and delete the second path instance. That should fix it - otherwise it could be a trip into the database.

If you need to make that trip, then you need to run:

http://xxx.xxx.xxx.xxx/moodle/admin/replace.php

then put in the path statement  /X/X/ and replace with  /X/ that should fix the rest of the problem...

In reply to Colin Fraser

Re: Moodle 1.9 directory twice in the path.

by Hassan Bourhrous -

Thanks Colin,

I think I know where the problem comes from although I have no idea how to solve it. It happens that the moodle folder is under:

 'http://xxx.xxx.xxx.xxx/moodle'

 

However, the address from outside the LAN is:

http://moodle.domain_name.top_level_domain is redirected to the address above. When some scripts are called, the directory moodle from the dirroot and from the redirect are appended to the path making the double string.

In reply to Hassan Bourhrous

Re: Moodle 1.9 directory twice in the path.

by Joe Zahaitis -

I am having the same exact problem.  I have access to "Config.php" and the wwwroot and "dataroot" (version 2.0.4) only show one instance of the doubled up directory.

The page gets created and with some workaround "page back" messing I can then get to the page, but there is still the issue that will mess with my teachers when it comes to them working on their classes.

I can "make the database" trip, but am unsure what you mean with your post.  Please to explain further.

Thanks,

Joe

In reply to Joe Zahaitis

Re: Moodle 1.9 directory twice in the path.

by Joe Zahaitis -

Ok, made the database trip as suggested.  edited the DB based on "replace.php" and it made a bunch of changes.  Still the problem persists.  /x/x/ is still happening when a summary is edited or a page (or anything else) is created for the first time.

In reply to Joe Zahaitis

Re: Moodle 1.9 directory twice in the path.

by Ken Task -
Picture of Particularly helpful Moodlers

What's the document root setting in Apache config?

DocumentRoot "/var/www/html/moodle" ?

should be "/var/www/html"

If running Apache virtuals (more than one host from single instance of Apache), there are also documentroot's defined in virtualhost tags defining the virtual host.

Sounds like firewall is re-directing URL's which is messing with the config of Apache/Moodle.  While using firewall to re-direct sounds good, it's not necessary as one can put a 0 second timelimit refresh auto forward default page (default.htm or index.html) located at the apache defined document root that auto forwards request to http://site/ to http://site/moodle.

< META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://FQDN/moodle/" >

By doing so, Moodle is control of it's own and anyone accessing the Moodle from inside or outside the private network will be accessing the same (no apparent difference).

'spirit of sharing', Ken

In reply to Joe Zahaitis

Re: Moodle 1.9 directory twice in the path.

by Hassan Bourhrous -

The same thing happens on Moodle 2.1. It turns out moodle takes the name of the directory under which it was installed and appends it to the paths of the php scripts. The combination with the redirect created the problem of the double string. However, I was lucky that my server is dedicated to moodle and other moodle sites under it. I put my moodle files directly under the www directory and redirected the URL to the IP rather than IP/moodle. Quick and dirty but it works!