[Moodle] Dynamically changing wwwroot

laurie Savage sav at pvgc.vic.edu.au
Sun Nov 23 18:36:38 EST 2008


Hi Moodlers and PHP coders,

I have a problem which I thought I'd solved but, alas, only made worse.
I'd be grateful for your suggestions.

Here goes:

Our college's moodle is located on a box 10.x.y.z within our intranet
which is visible to the Internet as  http://moodle.pvgc.vic.edu.au. Its
wwwroot in config.php is "http://moodle.pvgc.vic.edu.au" and users use
this address whether they are at school (intranet access) or at home. All
machines on our local network are prefixed with "10." and our border IP
identifies as 210.a.b.c.

When users access the site using the intranet and the
moodle.pvgc.vic.edu.au URL they get a lot of 403 errors and my logs report
a lot of header problems. A bit of research suggested DNS issues.

I thought I would fix this by having my intRAnet users use an alias
"http://moodle/" which points to 10.x.y.z and modifying config.php to test
whether the user's IP starts with 10. The result was access through the
intRAnet was greatly improved but the site was unusable over the intERnet
- the document root is identified as 10.x.y.z instead of
moodle.pvgc.vic.edu.au. Here is the modification:

$PVGCip = $_SERVER['REMOTE_ADDR'];
$PVGCparts = explode('.',$PVGCip);

if ($PVGCparts[0] = 10)
  {$CFG->wwwroot = "http://10.x.y.z";}
else
  {$CFG->wwwroot = "http://moodle.pvgc.vic.edu.au";}

(The logic in my script's first two lines works - try it in a little
script to display and reformat the contents of $parts[n])

Laurie
-- 
Laurie Savage
=
Student Assessment/Reporting & Tracking
Pascoe Vale Girls College
Pascoe Vale, Victoria, AU  9306 2544
-------------- next part --------------
An embedded message was scrubbed...
From: "Roland Gesthuizen" <rgesthuizen at gmail.com>
Subject: [Moodle] Mr Moodle
Date: Fri, 21 Nov 2008 17:19:45 +1100
Size: 5935
Url: http://www.edulists.com.au/pipermail/moodle/attachments/20081123/8fc7adcd/MoodleMrMoodle.mht


More information about the moodle mailing list